org.neo4j.kernel.ha.zookeeper
Class AbstractZooKeeperManager

java.lang.Object
  extended by org.neo4j.kernel.ha.zookeeper.AbstractZooKeeperManager
All Implemented Interfaces:
org.apache.zookeeper.Watcher
Direct Known Subclasses:
ClusterManager, ZooClient

public abstract class AbstractZooKeeperManager
extends Object
implements org.apache.zookeeper.Watcher

Contains basic functionality for a ZooKeeper manager, f.ex. how to get the current master in the cluster.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
org.apache.zookeeper.Watcher.Event
 
Field Summary
protected static String HA_SERVERS_CHILD
           
protected static int SESSION_TIME_OUT
           
 
Constructor Summary
AbstractZooKeeperManager(String servers, String storeDir)
           
 
Method Summary
protected  Map<Integer,Machine> getAllMachines(boolean wait)
           
 Pair<Master,Machine> getCachedMaster()
           
protected  String getHaServer(int machineId, boolean wait)
           
protected  Machine getMasterBasedOn(Collection<Machine> machines)
           
protected  Pair<Master,Machine> getMasterFromZooKeeper(boolean wait)
           
protected abstract  int getMyMachineId()
           
abstract  String getRoot()
           
protected abstract  org.apache.zookeeper.ZooKeeper getZooKeeper()
           
protected  org.apache.zookeeper.ZooKeeper instantiateZooKeeper()
           
protected  Pair<Integer,Integer> parseChild(String child)
           
protected  long readDataAsLong(String path)
           
protected  String readHaServer(int machineId, boolean wait)
           
 void shutdown()
           
abstract  void waitForSyncConnected()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.zookeeper.Watcher
process
 

Field Detail

HA_SERVERS_CHILD

protected static final String HA_SERVERS_CHILD
See Also:
Constant Field Values

SESSION_TIME_OUT

protected static final int SESSION_TIME_OUT
See Also:
Constant Field Values
Constructor Detail

AbstractZooKeeperManager

public AbstractZooKeeperManager(String servers,
                                String storeDir)
Method Detail

instantiateZooKeeper

protected org.apache.zookeeper.ZooKeeper instantiateZooKeeper()

getZooKeeper

protected abstract org.apache.zookeeper.ZooKeeper getZooKeeper()

getRoot

public abstract String getRoot()

parseChild

protected Pair<Integer,Integer> parseChild(String child)

readDataAsLong

protected long readDataAsLong(String path)
                       throws InterruptedException,
                              org.apache.zookeeper.KeeperException
Throws:
InterruptedException
org.apache.zookeeper.KeeperException

getMasterFromZooKeeper

protected Pair<Master,Machine> getMasterFromZooKeeper(boolean wait)

getMyMachineId

protected abstract int getMyMachineId()

getCachedMaster

public Pair<Master,Machine> getCachedMaster()

getMasterBasedOn

protected Machine getMasterBasedOn(Collection<Machine> machines)

getAllMachines

protected Map<Integer,Machine> getAllMachines(boolean wait)

getHaServer

protected String getHaServer(int machineId,
                             boolean wait)

readHaServer

protected String readHaServer(int machineId,
                              boolean wait)

shutdown

public void shutdown()

waitForSyncConnected

public abstract void waitForSyncConnected()


Copyright © 2010 The Neo4j Graph Database Project. All Rights Reserved.