org.apache.s4.comm.topology
Class AssignmentFromZK

java.lang.Object
  extended by org.apache.s4.comm.topology.AssignmentFromZK
All Implemented Interfaces:
Assignment, org.I0Itec.zkclient.IZkChildListener, org.I0Itec.zkclient.IZkDataListener, org.I0Itec.zkclient.IZkStateListener

public class AssignmentFromZK
extends java.lang.Object
implements Assignment, org.I0Itec.zkclient.IZkChildListener, org.I0Itec.zkclient.IZkStateListener, org.I0Itec.zkclient.IZkDataListener

Handles partition assignment through Zookeeper.


Constructor Summary
AssignmentFromZK(java.lang.String clusterName, java.lang.String zookeeperAddress, int sessionTimeout, int connectionTimeout)
           
 
Method Summary
 ClusterNode assignClusterNode()
           
 void handleChildChange(java.lang.String parentPath, java.util.List<java.lang.String> currentChilds)
           
 void handleDataChange(java.lang.String dataPath, java.lang.Object data)
           
 void handleDataDeleted(java.lang.String dataPath)
           
 void handleNewSession()
           
 void handleStateChanged(org.apache.zookeeper.Watcher.Event.KeeperState state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssignmentFromZK

@Inject
public AssignmentFromZK(java.lang.String clusterName,
                               java.lang.String zookeeperAddress,
                               int sessionTimeout,
                               int connectionTimeout)
                 throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

handleDataChange

public void handleDataChange(java.lang.String dataPath,
                             java.lang.Object data)
                      throws java.lang.Exception
Specified by:
handleDataChange in interface org.I0Itec.zkclient.IZkDataListener
Throws:
java.lang.Exception

handleDataDeleted

public void handleDataDeleted(java.lang.String dataPath)
                       throws java.lang.Exception
Specified by:
handleDataDeleted in interface org.I0Itec.zkclient.IZkDataListener
Throws:
java.lang.Exception

handleStateChanged

public void handleStateChanged(org.apache.zookeeper.Watcher.Event.KeeperState state)
                        throws java.lang.Exception
Specified by:
handleStateChanged in interface org.I0Itec.zkclient.IZkStateListener
Throws:
java.lang.Exception

handleNewSession

public void handleNewSession()
Specified by:
handleNewSession in interface org.I0Itec.zkclient.IZkStateListener

handleChildChange

public void handleChildChange(java.lang.String parentPath,
                              java.util.List<java.lang.String> currentChilds)
                       throws java.lang.Exception
Specified by:
handleChildChange in interface org.I0Itec.zkclient.IZkChildListener
Throws:
java.lang.Exception

assignClusterNode

public ClusterNode assignClusterNode()
Specified by:
assignClusterNode in interface Assignment
Returns:
the ClusterNode associated assigned to this process.