本文整理匯總了Java中org.apache.zookeeper.AsyncCallback.Children2Callback方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncCallback.Children2Callback方法的具體用法?Java AsyncCallback.Children2Callback怎麽用?Java AsyncCallback.Children2Callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.zookeeper.AsyncCallback
的用法示例。
在下文中一共展示了AsyncCallback.Children2Callback方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performBackgroundOperation
import org.apache.zookeeper.AsyncCallback; //導入方法依賴的package包/類
@Override
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
{
try
{
final OperationTrace trace = client.getZookeeperClient().startAdvancedTracer("GetChildrenBuilderImpl-Background");
AsyncCallback.Children2Callback callback = new AsyncCallback.Children2Callback()
{
@Override
public void processResult(int rc, String path, Object o, List<String> strings, Stat stat)
{
watching.commitWatcher(rc, false);
trace.setReturnCode(rc).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
if ( strings == null )
{
strings = Lists.newArrayList();
}
CuratorEventImpl event = new CuratorEventImpl(client, CuratorEventType.CHILDREN, rc, path, null, o, stat, null, strings, null, null, null);
client.processBackgroundOperation(operationAndData, event);
}
};
if ( watching.isWatched() )
{
client.getZooKeeper().getChildren(operationAndData.getData(), true, callback, backgrounding.getContext());
}
else
{
client.getZooKeeper().getChildren(operationAndData.getData(), watching.getWatcher(operationAndData.getData()), callback, backgrounding.getContext());
}
}
catch ( Throwable e )
{
backgrounding.checkError(e, watching);
}
}
示例2: performBackgroundOperation
import org.apache.zookeeper.AsyncCallback; //導入方法依賴的package包/類
@Override
public void performBackgroundOperation(final OperationAndData<Void> operationAndData) throws Exception
{
final OperationTrace trace = client.getZookeeperClient().startAdvancedTracer("FindAndDeleteProtectedNodeInBackground");
AsyncCallback.Children2Callback callback = new AsyncCallback.Children2Callback()
{
@Override
public void processResult(int rc, String path, Object o, List<String> strings, Stat stat)
{
trace.setReturnCode(rc).setPath(path).setStat(stat).commit();
if ( debugInsertError.compareAndSet(true, false) )
{
rc = KeeperException.Code.CONNECTIONLOSS.intValue();
}
if ( rc == KeeperException.Code.OK.intValue() )
{
final String node = CreateBuilderImpl.findNode(strings, "/", protectedId); // due to namespacing, don't let CreateBuilderImpl.findNode adjust the path
if ( node != null )
{
try
{
String deletePath = client.unfixForNamespace(ZKPaths.makePath(namespaceAdjustedParentPath, node));
client.delete().guaranteed().inBackground().forPath(deletePath);
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
log.error("Could not start guaranteed delete for node: " + node);
rc = KeeperException.Code.CONNECTIONLOSS.intValue();
}
}
}
if ( rc != KeeperException.Code.OK.intValue() )
{
CuratorEventImpl event = new CuratorEventImpl(client, CuratorEventType.CHILDREN, rc, path, null, o, stat, null, strings, null, null, null);
client.processBackgroundOperation(operationAndData, event);
}
}
};
client.getZooKeeper().getChildren(namespaceAdjustedParentPath, false, callback, null);
}
示例3: getChildren
import org.apache.zookeeper.AsyncCallback; //導入方法依賴的package包/類
@Override
public void getChildren(String path, Watcher watcher, AsyncCallback.Children2Callback cb, Object ctx) {
delegate.getChildren(path, watcher, cb, ctx);
}
示例4: getChildren
import org.apache.zookeeper.AsyncCallback; //導入方法依賴的package包/類
void getChildren(String path, Watcher watcher, AsyncCallback.Children2Callback cb, Object ctx);