Example usage for org.apache.zookeeper AsyncCallback.DataCallback AsyncCallback.DataCallback

List of usage examples for org.apache.zookeeper AsyncCallback.DataCallback AsyncCallback.DataCallback

Introduction

In this page you can find the example usage for org.apache.zookeeper AsyncCallback.DataCallback AsyncCallback.DataCallback.

Prototype

AsyncCallback.DataCallback

Source Link

Usage

From source file:org.midonet.midolman.state.ZkDirectory.java

License:Apache License

@Override
public void asyncGet(String relativePath, final DirectoryCallback<byte[]> dataCallback, TypedWatcher watcher) {
    zk.getZooKeeper().getData(getAbsolutePath(relativePath), wrapCallback(watcher),
            new AsyncCallback.DataCallback() {
                @Override//from  w  w w. j  a va  2s  .c o  m
                public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) {
                    if (rc == KeeperException.Code.OK.intValue()) {
                        dataCallback.onSuccess(data);
                    } else {
                        dataCallback.onError(KeeperException.create(KeeperException.Code.get(rc), path));
                    }
                }
            }, null);
}