public abstract class FutureEventDrivenOperation<ResultType> extends ZooKeeperOperation<ResultType> implements org.apache.zookeeper.Watcher, WatchedEventProvider
FutureEventDrivenOperation uses ZooKeepers Watcher
mechanism to await specific ZooKeeper events. Typically this is used to await
changes to a particular node before retrieving the change.connection, CONSTRUCTOR_ARGS, LOG, node, result, waitingThreads| Constructor and Description |
|---|
FutureEventDrivenOperation(org.apache.zookeeper.ZooKeeper connection,
String node,
org.apache.zookeeper.Watcher.Event.EventType... awaitedTypes) |
| Modifier and Type | Method and Description |
|---|---|
OperationResult<ResultType> |
get() |
OperationResult<ResultType> |
get(long timeout,
TimeUnit unit) |
org.apache.zookeeper.WatchedEvent |
getWatchedEvent() |
org.apache.zookeeper.Watcher.Event.EventType[] |
getWatchedForTypes() |
protected abstract void |
installWatch()
Install the watcher to receive
WatchedEvents. |
void |
process(org.apache.zookeeper.WatchedEvent event) |
cancel, createCopy, getNode, getResult, isCancelled, isDone, shouldProduceExchangepublic FutureEventDrivenOperation(org.apache.zookeeper.ZooKeeper connection,
String node,
org.apache.zookeeper.Watcher.Event.EventType... awaitedTypes)
public void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watcherpublic OperationResult<ResultType> get() throws InterruptedException, ExecutionException
get in class ZooKeeperOperation<ResultType>InterruptedExceptionExecutionExceptionpublic OperationResult<ResultType> get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in class ZooKeeperOperation<ResultType>InterruptedExceptionExecutionExceptionTimeoutExceptionprotected abstract void installWatch()
WatchedEvents. It should use the
appropriate asynchronous ZooKeeper call to do this so as not to block the
route from starting. Once one of the watched for types of event is
received a call is made to getResult, which can use the appropriate
synchronous call to retrieve the actual data.public org.apache.zookeeper.WatchedEvent getWatchedEvent()
getWatchedEvent in interface WatchedEventProviderpublic org.apache.zookeeper.Watcher.Event.EventType[] getWatchedForTypes()
Apache Camel