Method: ZK::Client::Unixisms#block_until_node_deleted

Defined in:
lib/zk/client/unixisms.rb

#block_until_node_deleted(abs_node_path) ⇒ Object

Will safely block the caller until abs_node_path has been removed (this is trickier than it appears at first). This method will wake the caller if a session event occurs that would ensure the event would never be delivered.

Raises:

  • If a session event occurs while we're blocked waiting for the node to be deleted, an exception that mixes in the InterruptedSession module will be raised, so for convenience, users can just rescue Exceptions::InterruptedSession.

  • raised when we receive ZOO_EXPIRED_SESSION_STATE while blocking waiting for a deleted event. Includes the Exceptions::InterruptedSession module.

  • raised when we receive ZOO_CONNECTING_STATE while blocking waiting for a deleted event. Includes the Exceptions::InterruptedSession module.

  • raised when we receive ZOO_CLOSED_STATE while blocking waiting for a deleted event. Includes the Exceptions::InterruptedSession module.



141
142
143
144
145
146
147
# File 'lib/zk/client/unixisms.rb', line 141

def block_until_node_deleted(abs_node_path)
  assert_we_are_not_on_the_event_dispatch_thread!

  raise ArgumentError, "argument must be String-ish, not: #{abs_node_path.inspect}" unless abs_node_path

  NodeDeletionWatcher.new(self, abs_node_path).block_until_deleted
end