Package org.apache.zookeeper
Class WatchedEvent
java.lang.Object
org.apache.zookeeper.WatchedEvent
A WatchedEvent represents a change on the ZooKeeper that a Watcher
is able to respond to. The WatchedEvent includes exactly what happened,
the current state of the ZooKeeper, and the path of the znode that
was involved in the event.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWatchedEvent(WatcherEvent eventMessage, long zxid) Convert a WatcherEvent sent over the wire into a full-fledged WatchedEventWatchedEvent(Watcher.Event.EventType eventType, Watcher.Event.KeeperState keeperState, String path) Create a WatchedEvent with specified type, state and pathWatchedEvent(Watcher.Event.EventType eventType, Watcher.Event.KeeperState keeperState, String path, long zxid) Create a WatchedEvent with specified type, state, path and zxid -
Method Summary
Modifier and TypeMethodDescriptiongetPath()getState()getType()Convert WatchedEvent to type that can be sent over networklonggetZxid()Returns the zxid of the transaction that triggered this watch if it is of one of the following types:Watcher.Event.EventType.NodeCreatedWatcher.Event.EventType.NodeDeletedWatcher.Event.EventType.NodeDataChangedWatcher.Event.EventType.NodeChildrenChangedOtherwise, returns -1L.toString()
-
Field Details
-
NO_ZXID
public static final long NO_ZXID- See Also:
-
-
Constructor Details
-
WatchedEvent
public WatchedEvent(Watcher.Event.EventType eventType, Watcher.Event.KeeperState keeperState, String path, long zxid) Create a WatchedEvent with specified type, state, path and zxid -
WatchedEvent
public WatchedEvent(Watcher.Event.EventType eventType, Watcher.Event.KeeperState keeperState, String path) Create a WatchedEvent with specified type, state and path -
WatchedEvent
Convert a WatcherEvent sent over the wire into a full-fledged WatchedEvent
-
-
Method Details
-
getState
-
getType
-
getPath
-
getZxid
public long getZxid()Returns the zxid of the transaction that triggered this watch if it is of one of the following types:Watcher.Event.EventType.NodeCreatedWatcher.Event.EventType.NodeDeletedWatcher.Event.EventType.NodeDataChangedWatcher.Event.EventType.NodeChildrenChanged
-
toString
-
getWrapper
Convert WatchedEvent to type that can be sent over network
-