Re: Recipe contrib -- was Re: [PATCH] a simple Leader Election or exclusive Write Lock protocol/policy

2008-07-21 Thread James Strachan
It should be pretty easy to link together the various recipe's from
the site/wiki and where possible share the recipe documentation across
languages

2008/7/18 Benjamin Reed [EMAIL PROTECTED]:
 Some initial implementations of a recipe may only be in C, so it would
 be nice to have a standard way of finding the recipe that wasn't
 dependent on the language that implements the recipe.

 ben

 James Strachan wrote:
 2008/7/17 Benjamin Reed [EMAIL PROTECTED]:

 Excellent proposal. The only thing I would add is that there should be
 an english description of the recipe in subversion. That way if someone
 wanted to do a compatible binding they can do it. If the recipe is on
 the wiki it would be hard to keep it in sync, so it is important that it
 is in subversion. My preference would be that the doc would be in the
 same contrib subdirectory as the source for ease of maintenance.


 Good idea. How about for Java recipe's we include the documentation as
 HTML with the javadoc so we can link to it easily and so that the
 recipe is kept with the code  versioned nicely (so as the
 recipe/algorithm changes we version it with the source code etc)







-- 
James
---
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com


Re: An interest in increasing the DI'ness of ZooKeeper?

2008-07-21 Thread Hiram Chirino
Will Do.

On Fri, Jul 18, 2008 at 1:40 PM, Benjamin Reed [EMAIL PROTECTED] wrote:
 This sounds great. I would suggest opening a Jira to work out the
 proposal and track the patch.

 ben

 Hiram Chirino wrote:
 Yep, I've looked that the test cases. In short to make that public API
 more DI friendly, we should:

 * Decouple the current configuration system from the public API.  I
 see stuff like ZooKeeperServer being coupled to ServerConfig a bit.
 * Allow the use of setter injection in addition to constructor
 injection. This is the most important thing needed to let spring more
 easily configure the objects.

 Regards,
 Hiram


 On Fri, Jul 18, 2008 at 12:53 PM, Mahadev Konar [EMAIL PROTECTED] wrote:

 Hi Hiram,

  Thanks for your feedback. Its great to hear from our users.

 About your question regarding injecting zookeeper servers in
 applications, we do have public api' that support creating zookeeper
 servers in an embedding application. Take a look at our test cases where
 we create zookeeper servers via the public api. Is this what you were
 looking for or I misunderstood the reference?

 Mahadev


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hiram
 Chirino
 Sent: Friday, July 18, 2008 9:07 AM
 To: zookeeper-dev@hadoop.apache.org
 Subject: An interest in increasing the DI'ness of ZooKeeper?

 Hi Guys,

 First off, great project!  I think ZooKeeper is a fabulous idea.  I
 can see folks wanting to embedd ZK servers in their products too.  I
 could see the ActiveMQ project embedding it for several reasons.  And
 with that in mind,  I think it would be awesome of ZK tried to use
 more dependency injection (DI) to configure it's objects.  That way
 and embedding project could directly configure it with java code, or
 use Spring or Guice etc. etc.

 If you guys are interested in supporting this use case, I'd be happy
 to start contributing patches to make that happen.

 --
 Regards,
 Hiram

 Blog: http://hiramchirino.com

 Open Source SOA
 http://open.iona.com










-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Open Source SOA
http://open.iona.com


[jira] Commented: (ZOOKEEPER-81) JMX module is using 1 java 6 method that has a java 5 equivalent

2008-07-21 Thread Hiram Chirino (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12615370#action_12615370
 ] 

Hiram Chirino commented on ZOOKEEPER-81:


The build lets me build under 1.5 and if I apply that patch it compiles and 
tests fine.  Perhaps that mxbean feature is only needed at runtime?

 JMX module is using 1 java 6 method that has a java 5 equivalent
 

 Key: ZOOKEEPER-81
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-81
 Project: Zookeeper
  Issue Type: Improvement
  Components: server
Reporter: Hiram Chirino
 Attachments: ZOOKEEPER-81.patch


 It would be nice if the jmx module compiled and ran on java 5 too.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (ZOOKEEPER-82) Make the ZooKeeperServer more DI friendly

2008-07-21 Thread Hiram Chirino (JIRA)
Make the ZooKeeperServer more DI friendly
-

 Key: ZOOKEEPER-82
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-82
 Project: Zookeeper
  Issue Type: Improvement
  Components: server
Reporter: Hiram Chirino


Proposed changes were discussed in [this mailing list 
thread|http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-dev/200807.mbox/[EMAIL
 PROTECTED]:

Basic goals are: 
* Decouple the current configuration system from the public API.  I
see stuff like ZooKeeperServer being coupled to ServerConfig a bit.
* Allow the use of setter injection in addition to constructor
injection. This is the most important thing needed to let spring more
easily configure the objects.
* Move the main() methods out of the ZooKeeperServer class.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (ZOOKEEPER-82) Make the ZooKeeperServer more DI friendly

2008-07-21 Thread Hiram Chirino (JIRA)

 [ 
https://issues.apache.org/jira/browse/ZOOKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hiram Chirino updated ZOOKEEPER-82:
---

Attachment: ZOOKEEPER-82.patch

Attaching patch that implements most of what was proposed.

 Make the ZooKeeperServer more DI friendly
 -

 Key: ZOOKEEPER-82
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-82
 Project: Zookeeper
  Issue Type: Improvement
  Components: server
Reporter: Hiram Chirino
 Attachments: ZOOKEEPER-82.patch


 Proposed changes were discussed in [this mailing list 
 thread|http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-dev/200807.mbox/[EMAIL
  PROTECTED]:
 Basic goals are: 
 * Decouple the current configuration system from the public API.  I
 see stuff like ZooKeeperServer being coupled to ServerConfig a bit.
 * Allow the use of setter injection in addition to constructor
 injection. This is the most important thing needed to let spring more
 easily configure the objects.
 * Move the main() methods out of the ZooKeeperServer class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Assigned: (ZOOKEEPER-81) JMX module is using 1 java 6 method that has a java 5 equivalent

2008-07-21 Thread Patrick Hunt (JIRA)

 [ 
https://issues.apache.org/jira/browse/ZOOKEEPER-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Hunt reassigned ZOOKEEPER-81:
-

Assignee: Andrew Kornev

Assigning to Andrew for followup/resolution.

 JMX module is using 1 java 6 method that has a java 5 equivalent
 

 Key: ZOOKEEPER-81
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-81
 Project: Zookeeper
  Issue Type: Improvement
  Components: server
Reporter: Hiram Chirino
Assignee: Andrew Kornev
 Attachments: ZOOKEEPER-81.patch


 It would be nice if the jmx module compiled and ran on java 5 too.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



New Contributors to ASF ZooKeeper

2008-07-21 Thread Patrick Hunt
Welcome Hiram Chirino and James Strachan to the ASF ZooKeeper 
contributor list.


Patrick


[jira] Assigned: (ZOOKEEPER-82) Make the ZooKeeperServer more DI friendly

2008-07-21 Thread Patrick Hunt (JIRA)

 [ 
https://issues.apache.org/jira/browse/ZOOKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Hunt reassigned ZOOKEEPER-82:
-

Assignee: Hiram Chirino

Assigned to Hiram.

 Make the ZooKeeperServer more DI friendly
 -

 Key: ZOOKEEPER-82
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-82
 Project: Zookeeper
  Issue Type: Improvement
  Components: server
Reporter: Hiram Chirino
Assignee: Hiram Chirino
 Attachments: ZOOKEEPER-82.patch


 Proposed changes were discussed in [this mailing list 
 thread|http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-dev/200807.mbox/[EMAIL
  PROTECTED]:
 Basic goals are: 
 * Decouple the current configuration system from the public API.  I
 see stuff like ZooKeeperServer being coupled to ServerConfig a bit.
 * Allow the use of setter injection in addition to constructor
 injection. This is the most important thing needed to let spring more
 easily configure the objects.
 * Move the main() methods out of the ZooKeeperServer class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Assigned: (ZOOKEEPER-79) Document jacob's leader election on the wiki recipes page

2008-07-21 Thread Patrick Hunt (JIRA)

 [ 
https://issues.apache.org/jira/browse/ZOOKEEPER-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Hunt reassigned ZOOKEEPER-79:
-

Assignee: Flavio Paiva Junqueira  (was: Patrick Hunt)

Assigning to Flavio to document this recipe.

 Document jacob's leader election on the wiki recipes page
 -

 Key: ZOOKEEPER-79
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-79
 Project: Zookeeper
  Issue Type: New Feature
  Components: documentation
Reporter: Patrick Hunt
Assignee: Flavio Paiva Junqueira

 The following discussion occurred on the zookeeper-user list. We need to 
 formalize this recipe and document on the wiki recipes page:
 -from jacob 
 Avinash
  
 The following protocol will help you fix the observed misbehavior. As Flavio 
 points out, you cannot rely on the order of nodes in getChildren, you must 
 use an intrinsic property of each node to determine who is the leader. The 
 protocol devised by Runping Qi and described here will do that.
  
 First of all, when you create child nodes of the node that holds the 
 leadership bids, you must create them with the EPHEMERAL and SEQUENCE flag. 
 ZooKeeper guarantees to give you an ephemeral node named uniquely and with a 
 sequence number larger by at least one than any previously created node in 
 the sequence. You provide a prefix, like L_ or your own choice, and 
 ZooKeeper creates nodes named L_23, L_24, etc. The sequence number starts 
 at 0 and increases monotonously.
  
 Once you've placed your leadership bid, you search backwards from the 
 sequence number of *your* node to see if there are any preceding (in terms of 
 the sequence number) nodes. When you find one, you place a watch on it and 
 wait for it to disappear. When you get the watch notification, you search 
 again, until you do not find a preceding node, then you know you're the 
 leader. This protocol guarantees that there is at any time only one node that 
 thinks it is the leader. But it does not disseminate information about who is 
 the leader. If you want everyone to know who is the leader, you can have an 
 additional Znode whose value is the name of the current leader (or some 
 identifying information on how to contact the leader, etc.). Note that this 
 cannot be done atomically, so by the time other nodes find out who the leader 
 is, the leadership may already have passed on to a different node.
  
 Flavio
  
 Might it make sense to provide a standardized implementation of leader 
 election in the library code in Java?
  
 --Jacob
  
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Flavio 
 Junqueira
 Sent: Friday, July 11, 2008 1:02 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [Zookeeper-user] Leader election
  
 Hi Avinash, getChildren returns a list in lexicographic order, so if you are 
 updating the children of the election node concurrently, then you may get a 
 different first node with different clients. If you are using the sequence 
 flag to create nodes, then you may consider stripping the prefix of the node 
 name and using the sufix value to determine order.
 Hope it helps.
 -Flavio
  
 - Original Message 
 From: Avinash Lakshman [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, July 11, 2008 7:20:06 AM
 Subject: [Zookeeper-user] Leader election
 Hi
 I am trying to elect leader among 50 nodes. There is always one odd guy who 
 seems to think that someone else distinct from what some other nodes see as 
 leader. Could someone please tell me what is wrong with the following code 
 for leader election:
 public void electLeader()
 {   
 ZooKeeper zk = StorageService.instance().getZooKeeperHandle();
 String path = /Leader;
 try
 {
 String createPath = path + /L-; 
   
 LeaderElector.createLock_.lock();
 while( true )
 {
 /* Get all znodes under the Leader znode */
 ListString values = zk.getChildren(path, false);
 /*
  * Get the first znode and if it is the
  * pathCreated created above then the data
  * in that znode is the leader's identity.
 */
 if ( leader_ == null )
 {
 leader_ = new AtomicReferenceEndPoint( 
 EndPoint.fromBytes( zk.getData(path + / + values.get(0), false, null) ) );
 }
 else
 {
 leader_.set( EndPoint.fromBytes( zk.getData(path + 
 / + values .get(0), false, null) ) );
 /* Disseminate 

Re: New Contributors to ASF ZooKeeper

2008-07-21 Thread Patrick Hunt

Anthony Urso has also been added to the list of contributors.

Patrick

Patrick Hunt wrote:
Welcome Hiram Chirino and James Strachan to the ASF ZooKeeper 
contributor list.


Patrick


[jira] Created: (ZOOKEEPER-83) Switch to using maven to build ZooKeeper

2008-07-21 Thread Hiram Chirino (JIRA)
Switch to using maven to build ZooKeeper


 Key: ZOOKEEPER-83
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-83
 Project: Zookeeper
  Issue Type: Improvement
  Components: build
Reporter: Hiram Chirino
Assignee: Hiram Chirino
 Attachments: zookeeper-mavened.tgz

Maven is a great too for building java projects at the ASF.  It helps 
standardize the build a bit since it's a convention oriented.
It's dependency auto downloading would remove the need to store the 
dependencies in svn, and it will handle many of the suggested ASF policies like 
gpg signing of the releases and such.

The ZooKeeper build is almost vanilla except for the jute compiler bits.  
Things that would need to change are:
 * re-organize the source tree a little so that it uses the maven directory 
conventions
 * seperate the jute bits out into seperate modules so that a maven plugin can 
be with it
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (ZOOKEEPER-83) Switch to using maven to build ZooKeeper

2008-07-21 Thread Hiram Chirino (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12615494#action_12615494
 ] 

Hiram Chirino commented on ZOOKEEPER-83:


I just attached a mavenized version of ZooKeeper based on rev 677371

I would have provided a patch, but due to the directory re-organizations, it 
would be too hard to produce and apply.  So attached is a full source distro, 
please evaluate and comment.  Hopefully if folks like it, it can be used as a 
guide.

For folks who are new to maven, here is a quick guide:

to build: mvn install
to clean mvn clean
to clean build: mvn clean install

to skip tests during a build: mvn install -Dtest=false 
to create eclipse project files: mvn eclipse:eclipse
to create intelij projects files: mvn idea:idea



 Switch to using maven to build ZooKeeper
 

 Key: ZOOKEEPER-83
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-83
 Project: Zookeeper
  Issue Type: Improvement
  Components: build
Reporter: Hiram Chirino
Assignee: Hiram Chirino
 Attachments: zookeeper-mavened.tgz


 Maven is a great too for building java projects at the ASF.  It helps 
 standardize the build a bit since it's a convention oriented.
 It's dependency auto downloading would remove the need to store the 
 dependencies in svn, and it will handle many of the suggested ASF policies 
 like gpg signing of the releases and such.
 The ZooKeeper build is almost vanilla except for the jute compiler bits.  
 Things that would need to change are:
  * re-organize the source tree a little so that it uses the maven directory 
 conventions
  * seperate the jute bits out into seperate modules so that a maven plugin 
 can be with it
  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (ZOOKEEPER-83) Switch to using maven to build ZooKeeper

2008-07-21 Thread Mahadev konar (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12615507#action_12615507
 ] 

Mahadev konar commented on ZOOKEEPER-83:


hiram, can you list an overall set of changes you had to make to make the src 
tree maven compatible. It would help with people who do not want to download 
the tgz to see what the changes are. 


 Switch to using maven to build ZooKeeper
 

 Key: ZOOKEEPER-83
 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-83
 Project: Zookeeper
  Issue Type: Improvement
  Components: build
Reporter: Hiram Chirino
Assignee: Hiram Chirino
 Attachments: zookeeper-mavened.tgz


 Maven is a great too for building java projects at the ASF.  It helps 
 standardize the build a bit since it's a convention oriented.
 It's dependency auto downloading would remove the need to store the 
 dependencies in svn, and it will handle many of the suggested ASF policies 
 like gpg signing of the releases and such.
 The ZooKeeper build is almost vanilla except for the jute compiler bits.  
 Things that would need to change are:
  * re-organize the source tree a little so that it uses the maven directory 
 conventions
  * seperate the jute bits out into seperate modules so that a maven plugin 
 can be with it
  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.