Java Code Examples for org.apache.zookeeper.AsyncCallback#StatCallback

The following examples show how to use org.apache.zookeeper.AsyncCallback#StatCallback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExistsBuilderImpl.java    From xian with Apache License 2.0 5 votes vote down vote up
@Override
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
{
    try
    {
        final OperationTrace   trace = client.getZookeeperClient().startAdvancedTracer("ExistsBuilderImpl-Background");
        AsyncCallback.StatCallback callback = new AsyncCallback.StatCallback()
        {
            @Override
            public void processResult(int rc, String path, Object ctx, Stat stat)
            {
                trace.setReturnCode(rc).setPath(path).setWithWatcher(watching.getWatcher() != null).setStat(stat).commit();
                CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.EXISTS, rc, path, null, ctx, stat, null, null, null, null);
                client.processBackgroundOperation(operationAndData, event);
            }
        };
        if ( watching.isWatched() )
        {
            client.getZooKeeper().exists(operationAndData.getData(), true, callback, backgrounding.getContext());
        }
        else
        {
            client.getZooKeeper().exists(operationAndData.getData(), watching.getWatcher(), callback, backgrounding.getContext());
        }
    }
    catch ( Throwable e )
    {
        backgrounding.checkError(e);
    }
}
 
Example 2
Source File: ExistsBuilderImpl.java    From curator with Apache License 2.0 5 votes vote down vote up
@Override
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
{
    try
    {
        final OperationTrace   trace = client.getZookeeperClient().startAdvancedTracer("ExistsBuilderImpl-Background");
        AsyncCallback.StatCallback callback = new AsyncCallback.StatCallback()
        {
            @Override
            public void processResult(int rc, String path, Object ctx, Stat stat)
            {
                watching.commitWatcher(rc, true);
                trace.setReturnCode(rc).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
                CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.EXISTS, rc, path, null, ctx, stat, null, null, null, null, null);
                client.processBackgroundOperation(operationAndData, event);
            }
        };
        if ( watching.isWatched() )
        {
            client.getZooKeeper().exists(operationAndData.getData(), true, callback, backgrounding.getContext());
        }
        else
        {
            client.getZooKeeper().exists(operationAndData.getData(), watching.getWatcher(operationAndData.getData()), callback, backgrounding.getContext());
        }
    }
    catch ( Throwable e )
    {
        backgrounding.checkError(e, watching);
    }
}
 
Example 3
Source File: ZookeeperClient.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param path Path.
 * @param watcher Watcher.
 * @param cb Callback.
 */
void existsAsync(String path, Watcher watcher, AsyncCallback.StatCallback cb) {
    ExistsOperation op = new ExistsOperation(path, watcher, cb);

    zk.exists(path, watcher, new StatCallbackWrapper(op), null);
}
 
Example 4
Source File: ZookeeperClient.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param path Path.
 * @param watcher Watcher.
 * @param cb Callback.
 */
ExistsOperation(String path, Watcher watcher, AsyncCallback.StatCallback cb) {
    this.path = path;
    this.watcher = watcher;
    this.cb = cb;
}
 
Example 5
Source File: ZooKeeperConnection.java    From util with Apache License 2.0 4 votes vote down vote up
public void exists(final String path, final Watcher watcher, final AsyncCallback.StatCallback cb, final Object ctx) {
    zooKeeper.exists(path, watcher, cb, ctx);
}
 
Example 6
Source File: ZooKeeperConnection.java    From util with Apache License 2.0 4 votes vote down vote up
public void exists(final String path, final boolean watch, final AsyncCallback.StatCallback cb, final Object ctx) {
    zooKeeper.exists(path, watch, cb, ctx);
}
 
Example 7
Source File: ZooKeeperConnection.java    From util with Apache License 2.0 4 votes vote down vote up
public void setData(final String path, final byte[] data, final int version, final AsyncCallback.StatCallback cb, final Object ctx) {
    zooKeeper.setData(path, data, version, cb, ctx);
}
 
Example 8
Source File: ZooKeeperConnection.java    From util with Apache License 2.0 4 votes vote down vote up
public void setACL(final String path, final List<ACL> acl, final int version, final AsyncCallback.StatCallback cb, final Object ctx) {
    zooKeeper.setACL(path, acl, version, cb, ctx);
}
 
Example 9
Source File: ZooKeeperImpl.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
@Override
public void exists(String path, Watcher watcher, AsyncCallback.StatCallback cb, Object ctx) {
    delegate.exists(path, watcher, cb, ctx);
}
 
Example 10
Source File: ZooKeeperImpl.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
@Override
public void exists(String path, boolean watch, AsyncCallback.StatCallback cb, Object ctx) {
    delegate.exists(path, watch, cb, ctx);
}
 
Example 11
Source File: ZooKeeperImpl.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
@Override
public void setData(String path, byte[] data, int version, AsyncCallback.StatCallback cb, Object ctx) {
    delegate.setData(path, data, version, cb, ctx);
}
 
Example 12
Source File: ZooKeeperImpl.java    From hbase-indexer with Apache License 2.0 4 votes vote down vote up
@Override
public void setACL(String path, List<ACL> acl, int version, AsyncCallback.StatCallback cb, Object ctx) {
    delegate.setACL(path, acl, version, cb, ctx);
}
 
Example 13
Source File: ZooKeeperItf.java    From hbase-indexer with Apache License 2.0 votes vote down vote up
void exists(String path, Watcher watcher, AsyncCallback.StatCallback cb, Object ctx); 
Example 14
Source File: ZooKeeperItf.java    From hbase-indexer with Apache License 2.0 votes vote down vote up
void exists(String path, boolean watch, AsyncCallback.StatCallback cb, Object ctx); 
Example 15
Source File: ZooKeeperItf.java    From hbase-indexer with Apache License 2.0 votes vote down vote up
void setData(String path, byte[] data, int version, AsyncCallback.StatCallback cb, Object ctx); 
Example 16
Source File: ZooKeeperItf.java    From hbase-indexer with Apache License 2.0 votes vote down vote up
void setACL(String path, List<ACL> acl, int version, AsyncCallback.StatCallback cb, Object ctx);