Example usage for org.apache.zookeeper ZooKeeper getACL

List of usage examples for org.apache.zookeeper ZooKeeper getACL

Introduction

In this page you can find the example usage for org.apache.zookeeper ZooKeeper getACL.

Prototype

public void getACL(final String path, Stat stat, ACLCallback cb, Object ctx) 

Source Link

Document

The asynchronous version of getACL.

Usage

From source file:org.apache.bookkeeper.zookeeper.BkZooKeeperClient.java

License:Apache License

@Override
public void getACL(final String path, final Stat stat, final ACLCallback cb, final Object context) {
    final Runnable proc = new ZkRetryRunnable(operationRetryPolicy, rateLimiter, getACLStats) {

        final ACLCallback aclCb = new ACLCallback() {

            @Override/*from   w  w w.jav  a  2s  .com*/
            public void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat) {
                BkZooWorker worker = (BkZooWorker) ctx;
                if (allowRetry(worker, rc)) {
                    backOffAndRetry(that, worker.nextRetryWaitTime());
                } else {
                    cb.processResult(rc, path, context, acl, stat);
                }
            }

        };

        @Override
        public String toString() {
            return String.format("getACL (%s, stat = %s)", path, stat);
        }

        @Override
        void zkRun() {
            ZooKeeper zkHandle = zk.get();
            if (null == zkHandle) {
                BkZooKeeperClient.super.getACL(path, stat, aclCb, worker);
            } else {
                zkHandle.getACL(path, stat, aclCb, worker);
            }
        }
    };
    // execute it immediately
    proc.run();
}

From source file:org.apache.bookkeeper.zookeeper.ZooKeeperClient.java

License:Apache License

@Override
public void getACL(final String path, final Stat stat, final ACLCallback cb, final Object context) {
    final Runnable proc = new ZkRetryRunnable(operationRetryPolicy, rateLimiter, getACLStats) {

        final ACLCallback aclCb = new ACLCallback() {

            @Override/*from w  ww . j  a v a 2 s.  c  o m*/
            public void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat) {
                ZooWorker worker = (ZooWorker) ctx;
                if (allowRetry(worker, rc)) {
                    backOffAndRetry(that, worker.nextRetryWaitTime());
                } else {
                    cb.processResult(rc, path, context, acl, stat);
                }
            }

        };

        @Override
        public String toString() {
            return String.format("getACL (%s, stat = %s)", path, stat);
        }

        @Override
        void zkRun() {
            ZooKeeper zkHandle = zk.get();
            if (null == zkHandle) {
                ZooKeeperClient.super.getACL(path, stat, aclCb, worker);
            } else {
                zkHandle.getACL(path, stat, aclCb, worker);
            }
        }
    };
    // execute it immediately
    proc.run();
}