for my current code I'm using zkclient[1] and have also looked at cages[2] for 
some ZK usage examples. I observed, that there's a common pattern to wrap ZK 
operations in callables and feed them to a "retryUntilConnected" executor.

Now my idea is, that ZK should already come with operations in classes, e.g.:

o.a.z.operation.Create extends Operation implements callable{
  private path, data[], acl, createMode

  public Create( .. all kind of ctors .. )

  public call(){
    .. move code from Zookeeper.create() here

Similiar classes should be provided for getChildren, delete, exists, getData, 
getACL, setACL and setData.

One could then feed such operations to an ZkExecutor, which has the necessary 
knowledge about the ZkConnection and can execute a command either 
synchronously or asynchronously.

One could also wrap operations in an ExceptionCatcher to ignore certain 
Exceptions or in a RetryPolicy.

This is only an idea so far, but I wanted to share my thoughts before starting 
to try it out. (BTW: You can meet me at BerlinBuzzwords.de)

[1] http://github.com/sgroschupf/zkclient
[2] http://code.google.com/p/cages/

Best regards,

Thomas Koch, http://www.koch.ro

Reply via email to