List of usage examples for org.apache.zookeeper KeeperException code
Code code
To view the source code for org.apache.zookeeper KeeperException code.
Click Source Link
From source file:org.apache.curator.framework.recipes.queue.DistributedQueue.java
License:Apache License
private void doPutInBackground(final T item, String path, final MultiItem<T> givenMultiItem, byte[] bytes) throws Exception { BackgroundCallback callback = new BackgroundCallback() { @Override/*from w ww. j av a 2 s .com*/ public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { if (event.getResultCode() != KeeperException.Code.OK.intValue()) { return; } if (event.getType() == CuratorEventType.CREATE) { synchronized (putCount) { putCount.decrementAndGet(); putCount.notifyAll(); } } putListenerContainer.forEach(new Function<QueuePutListener<T>, Void>() { @Override public Void apply(QueuePutListener<T> listener) { if (item != null) { listener.putCompleted(item); } else { listener.putMultiCompleted(givenMultiItem); } return null; } }); } }; internalCreateNode(path, bytes, callback); }
From source file:org.apache.curator.x.async.AsyncResult.java
License:Apache License
/** * Return the ZooKeeper result code. If the method was successful, * {@link org.apache.zookeeper.KeeperException.Code#OK} is returned. If there was a general * exception {@link org.apache.zookeeper.KeeperException.Code#SYSTEMERROR} is returned. * * @return result code/* www . ja va 2 s .com*/ */ KeeperException.Code getCode();
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
public AsyncResultImpl() { this(null, KeeperException.Code.OK, null); }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
public AsyncResultImpl(KeeperException.Code code) { this(null, code, null); }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
public AsyncResultImpl(T value) { this(value, KeeperException.Code.OK, null); }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
public AsyncResultImpl(Throwable exception) { this(null, KeeperException.Code.SYSTEMERROR, exception); }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
private AsyncResultImpl(T value, KeeperException.Code code, Throwable exception) { this.value = value; this.exception = exception; this.code = Objects.requireNonNull(code, "error cannot be null"); }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
public KeeperException.Code getCode() { return code; }
From source file:org.apache.curator.x.async.details.AsyncResultImpl.java
License:Apache License
@Override public void checkError() { checkException();// w w w . j av a 2s .com if (code != KeeperException.Code.OK) { throw new RuntimeException(KeeperException.create(code)); } }
From source file:org.apache.curator.x.async.details.BackgroundProcs.java
License:Apache License
static <T> BackgroundProc<T> makeProc(Function<CuratorEvent, T> proc) { return (event, future) -> { if (event.getResultCode() == 0) { future.complete(proc.apply(event)); } else {/*from w w w .j a v a 2s . c o m*/ future.completeExceptionally( KeeperException.create(KeeperException.Code.get(event.getResultCode()), event.getPath())); } return null; }; }