public class AnyOfOperations extends ZooKeeperOperation implements WatchedEventProvider
AnyOfOperations
is a composite operation of one or more sub
operation, executing each in turn until any one succeeds. If any execute
successfully, this operation succeeds; if the sub operations are all executed
without success it fails.
It is mostly used for test and watch scenarios where a node is tested for existence, data or children, falling back to a corresponding watch operation if the test operation fails.
connection, CONSTRUCTOR_ARGS, LOG, node, result, waitingThreads
Constructor and Description |
---|
AnyOfOperations(String node,
ZooKeeperOperation... keeperOperations) |
Modifier and Type | Method and Description |
---|---|
ZooKeeperOperation |
createCopy() |
OperationResult |
get() |
OperationResult |
get(long timeout,
TimeUnit unit) |
OperationResult |
getResult()
Gets the result of this zookeeper operation, i.e.
|
org.apache.zookeeper.WatchedEvent |
getWatchedEvent() |
cancel, getNode, isCancelled, isDone, shouldProduceExchange
public AnyOfOperations(String node, ZooKeeperOperation... keeperOperations)
public OperationResult get() throws InterruptedException, ExecutionException
get
in class ZooKeeperOperation
InterruptedException
ExecutionException
public OperationResult get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in class ZooKeeperOperation
InterruptedException
ExecutionException
TimeoutException
public OperationResult getResult()
ZooKeeperOperation
getResult
in class ZooKeeperOperation
public ZooKeeperOperation createCopy() throws Exception
createCopy
in class ZooKeeperOperation
Exception
public org.apache.zookeeper.WatchedEvent getWatchedEvent()
getWatchedEvent
in interface WatchedEventProvider
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.