listeners on Leader Latch?

322 views
Skip to first unread message

Eric Tschetter

unread,
Apr 17, 2013, 1:22:19 PM4/17/13
to curato...@googlegroups.com
Hi guys,

I'm looking at using Leader Latch and I noticed it only has polling mechanisms for figuring out if you are the leader.  I was wondering if there is a reason to not have a callback mechanism that you can register with two methods:

startBeingMaster();
stopBeingMaster();

Basically, any time setLeadership() is called with a value other than what it was, it would cause either startBeingMaster() to be called or stopBeingMaster() to be called.

I can effect this using an extra thread and the polling mechanisms that are there, but am wondering if I'm the only one that would prefer to interact with it in this way or if others would also prefer to have access to this type of API?

(Btw, for anyone wondering, I'm currently swapping out an old zookeeper client library for Curator and that's why I have all of these random questions about APIs and stuff)

--Eric

Jordan Zimmerman

unread,
Apr 17, 2013, 2:48:42 PM4/17/13
to curato...@googlegroups.com
Look at LeaderSelector. It is a leader recipe that has a callback mechanism. 

====================
Jordan Zimmerman
--
You received this message because you are subscribed to the Google Groups "curator-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to curator-user...@googlegroups.com.
To post to this group, send email to curato...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Eric Tschetter

unread,
Apr 17, 2013, 3:23:53 PM4/17/13
to curato...@googlegroups.com
You and your super-secret undocumented recipes!  Checking it out.

Eric Tschetter

unread,
Apr 17, 2013, 3:27:16 PM4/17/13
to curato...@googlegroups.com
Oh, that's the Leader Election recipe.

I don't really like that abstraction either because it makes me worry about too much:

1) Losing connection, etc.
2) "Relinquishing" leadership

I just want to either be the leader or not be the leader and have that choice be completely external.  That is, I want something to tell me that I became the leader or that I lost leadership.  I assume that I can always give up my leadership by just closing the thing down.

--Eric

Eric Tschetter

unread,
Apr 17, 2013, 5:41:11 PM4/17/13
to curato...@googlegroups.com
Just submitted a pull request for this, hopefully it doesn't go completely against your sensibilities.


--Eric 
Reply all
Reply to author
Forward
0 new messages