trait SynchronousWatchableZookeeper extends Zookeeper
A ZooKeeper client with synchronous and watchable operations.
- Alphabetic
- By Inheritance
- SynchronousWatchableZookeeper
- Zookeeper
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def async: AsynchronousZookeeper
Returns a view of this client in which operations are performed asynchronously.
Returns a view of this client in which operations are performed asynchronously.
- returns
an asynchronous view of this client
- Definition Classes
- Zookeeper
- abstract def children(path: String): Seq[String]
Returns the children of the node specified by the given path and additionally sets a watch for any changes.
Returns the children of the node specified by the given path and additionally sets a watch for any changes.
The watch is triggered when one of the following conditions occur:
- the session state changes
- path
the path of the node
- returns
an unordered sequence containing the names of each child node
- Exceptions thrown
NoNodeException
if the node does not exist
- abstract def close(): Unit
Closes the client connection to the ZooKeeper cluster.
Closes the client connection to the ZooKeeper cluster.
A consequence of closing the connection is that ZooKeeper will expire the corresponding session, which further implies that all ephemeral nodes created by this client will be deleted.
- Definition Classes
- Zookeeper
- abstract def ensure(path: String): Future[Unit]
Ensures that the value of a node, specified by the given path, is synchronized across the ZooKeeper cluster.
Ensures that the value of a node, specified by the given path, is synchronized across the ZooKeeper cluster.
An important note on consistency: ZooKeeper does not guarantee, for any given point in time, that all clients will have a consistent view of the cluster. Since reads can be served by any node in the cluster, whereas writes are serialized through the leader, there exists the possibility in which two separate clients may have inconsistent views. This scenario occurs when the leader commits a change once consensus is reached, but the change has not yet propagated across the cluster. Therefore, reads occurring before the commit has propagated will be globally inconsistent. This behavior is normally acceptable, but for some use cases, writes may need to be globally visible before subsequent reads occur.
This method is particularly useful when a write occurring in one process is followed by a read in another process. For example, consider the following sequence of operations:
- process A writes a value
- process A sends a message to process B
- process B reads the value
The assumption is that process B expects to see the value written by process A, but as mentioned, ZooKeeper does not make this guarantee. A call to this method before process B attempts to read the value ensures that all prior writes are consistently applied across the cluster, thus observing the write in process A.
- returns
a future that completes when the node is synchronized across the cluster
- Definition Classes
- Zookeeper
- abstract def exists(path: String): Option[Status]
Returns the status of the node specified by the given path if it exists and additionally sets a watch for any changes.
Returns the status of the node specified by the given path if it exists and additionally sets a watch for any changes.
The watch is triggered when one of the following conditions occur:
- the data associated with the node changes
- the node is created
- the node is deleted
- the session state changes
- path
the path of the node
- returns
a
Some
containing the node status orNone
if the node does not exist
- abstract def get(path: String): (Array[Byte], Status)
Returns the data and status of the node specified by the given path and additionally sets a watch for any changes.
Returns the data and status of the node specified by the given path and additionally sets a watch for any changes.
The watch is triggered when one of the following conditions occur:
- the data associated with the node changes
- the node is deleted
- the session state changes
- path
the path of the node
- returns
a tuple containing the data and status of the node
- Exceptions thrown
NoNodeException
if the node does not exist
- abstract def observe(path: String, recursive: Boolean = false): Unit
Sets a persistent watch for any changes on the node specified by the given path.
Sets a persistent watch for any changes on the node specified by the given path.
For non-recursive watches, the watch function is triggered when the following events occur:
- the data associated with the node changes DataChanged
- a direct child node is created or deleted ChildrenChanged
For recursive watches, the watch function is triggered when the following events occur:
- the data associated with any node in the tree changes DataChanged
- any child node in the tree is created Created
- any child node in the tree is deleted Deleted
The watch is always triggered when the following events occur:
- the watch is removed PersistentWatchRemoved
- the session state changes
- path
the path of the node
- recursive
if the watch should apply to all child nodes
- Exceptions thrown
InterruptedException
- If the server transaction is interrupted.KeeperException
- If the server signals an error with a non-zero error code.
- abstract def session(): Session
Returns the session associated with ZooKeeper.
Returns the session associated with ZooKeeper.
Note that the connection with ZooKeeper is established asynchronously, which means there is no implied guarantee that the session has connected nor will eventually connect at the time that an instance of this trait is created.
- returns
the session associated with ZooKeeper
- Definition Classes
- Zookeeper
- abstract def sync: SynchronousZookeeper
Returns a view of this client in which operations are performed synchronously.
Returns a view of this client in which operations are performed synchronously.
- returns
a synchronous view of this client
- Definition Classes
- Zookeeper
- abstract def unobserve(path: String, observer: Observer, local: Boolean = false): Unit
Removes any watchers matching the observer type on the node specified by the given path.
Removes any watchers matching the observer type on the node specified by the given path.
- path
the path of the node
- observer
the type of watcher
- local
indicates that the watcher should be removed locally when there is no server connection
- Exceptions thrown
InterruptedException
- If the server transaction is interrupted.KeeperException
- If the server signals an error with a non-zero error code.NoWatcherException
- If no matching watcher exists.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()