org.apache.camel.component.zookeeper.operations
Class FutureEventDrivenOperation<ResultType>
java.lang.Object
org.apache.camel.component.zookeeper.operations.ZooKeeperOperation<ResultType>
org.apache.camel.component.zookeeper.operations.FutureEventDrivenOperation<ResultType>
- All Implemented Interfaces:
- WatchedEventProvider, org.apache.zookeeper.Watcher
- Direct Known Subclasses:
- ChildrenChangedOperation, DataChangedOperation, ExistenceChangedOperation
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.
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
org.apache.zookeeper.Watcher.Event |
Constructor Summary |
FutureEventDrivenOperation(org.apache.zookeeper.ZooKeeper connection,
String node,
org.apache.zookeeper.Watcher.Event.EventType... awaitedTypes)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FutureEventDrivenOperation
public FutureEventDrivenOperation(org.apache.zookeeper.ZooKeeper connection,
String node,
org.apache.zookeeper.Watcher.Event.EventType... awaitedTypes)
process
public void process(org.apache.zookeeper.WatchedEvent event)
- Specified by:
process
in interface org.apache.zookeeper.Watcher
get
public OperationResult<ResultType> get()
throws InterruptedException,
ExecutionException
- Overrides:
get
in class ZooKeeperOperation<ResultType>
- Throws:
InterruptedException
ExecutionException
get
public OperationResult<ResultType> get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
- Overrides:
get
in class ZooKeeperOperation<ResultType>
- Throws:
InterruptedException
ExecutionException
TimeoutException
installWatch
protected abstract void installWatch()
- Install the watcher to receive
WatchedEvent
s. 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.
getWatchedEvent
public org.apache.zookeeper.WatchedEvent getWatchedEvent()
- Specified by:
getWatchedEvent
in interface WatchedEventProvider
getWatchedForTypes
public org.apache.zookeeper.Watcher.Event.EventType[] getWatchedForTypes()
Apache CAMEL