Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

shutdown broadcast callback when we're done with it

  • Loading branch information...
commit 8705f00194504ed4af6bd32f6d337321050ef6be 1 parent 8f8f857
@slyphon authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/zk-group/group_base.rb
View
4 lib/zk-group/group_base.rb
@@ -59,6 +59,8 @@ def initialize(zk, name, opts={})
@known_members = []
@membership_subscriptions = []
+ # ThreadedCallback will queue calls to the block and deliver them one at a time
+ # on their own thread. This guarantees order and simplifies locking.
@broadcast_callback = ThreadedCallback.new { |event| broadcast_membership_change!(event) }
@membership_ev_sub = zk.register(path, :only => :child) do |event|
@@ -79,6 +81,8 @@ def close
return unless @created
@created = false
+ @broadcast_callback.shutdown
+
@on_connected_sub.unsubscribe
@membership_ev_sub.unsubscribe
Please sign in to comment.
Something went wrong with that request. Please try again.