org.apache.camel.component.zookeeper.operations
Class AnyOfOperations

java.lang.Object
  extended by org.apache.camel.component.zookeeper.operations.ZooKeeperOperation
      extended by org.apache.camel.component.zookeeper.operations.AnyOfOperations
All Implemented Interfaces:
WatchedEventProvider

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.


Field Summary
 
Fields inherited from class org.apache.camel.component.zookeeper.operations.ZooKeeperOperation
connection, CONSTRUCTOR_ARGS, LOG, node, result, waitingThreads
 
Constructor Summary
AnyOfOperations(String node, ZooKeeperOperation... keeperOperations)
           
 
Method Summary
 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()
           
 
Methods inherited from class org.apache.camel.component.zookeeper.operations.ZooKeeperOperation
cancel, getNode, isCancelled, isDone, shouldProduceExchange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnyOfOperations

public AnyOfOperations(String node,
                       ZooKeeperOperation... keeperOperations)
Method Detail

get

public OperationResult get()
                    throws InterruptedException,
                           ExecutionException
Overrides:
get in class ZooKeeperOperation
Throws:
InterruptedException
ExecutionException

get

public OperationResult get(long timeout,
                           TimeUnit unit)
                    throws InterruptedException,
                           ExecutionException,
                           TimeoutException
Overrides:
get in class ZooKeeperOperation
Throws:
InterruptedException
ExecutionException
TimeoutException

getResult

public OperationResult getResult()
Description copied from class: ZooKeeperOperation
Gets the result of this zookeeper operation, i.e. some data and the associated node stats

Specified by:
getResult in class ZooKeeperOperation

createCopy

public ZooKeeperOperation createCopy()
                              throws Exception
Overrides:
createCopy in class ZooKeeperOperation
Throws:
Exception

getWatchedEvent

public org.apache.zookeeper.WatchedEvent getWatchedEvent()
Specified by:
getWatchedEvent in interface WatchedEventProvider


Apache Camel