public class ZooClient extends Object implements org.neo4j.kernel.lifecycle.Lifecycle, CompatibilityMonitor
| Modifier and Type | Field and Description |
|---|---|
protected Machine |
cachedMaster |
protected static String |
COMPATIBILITY_CHILD_18 |
protected static String |
COMPATIBILITY_CHILD_19 |
protected static String |
FLUSH_REQUESTED_CHILD |
protected static String |
HA_SERVERS_CHILD |
protected org.neo4j.kernel.impl.util.StringLogger |
msgLog |
static Machine |
NO_MACHINE |
protected static int |
STOP_FLUSHING |
| Constructor and Description |
|---|
ZooClient(org.neo4j.kernel.impl.util.StringLogger stringLogger,
org.neo4j.kernel.configuration.Config conf) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompatibilityModeListener(CompatibilityModeListener listener) |
void |
addZooListener(ZooListener zooListener) |
protected String |
asRootPath(org.neo4j.kernel.impl.nioneo.store.StoreId storeId) |
protected Map<Integer,ZooKeeperMachine> |
getAllMachines(boolean wait) |
protected Map<Integer,ZooKeeperMachine> |
getAllMachines(boolean wait,
org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode) |
protected Map<Integer,ZooKeeperMachine> |
getAllMachinesInner(boolean wait,
org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode) |
Machine |
getCachedMaster() |
String |
getClusterServer() |
org.neo4j.kernel.impl.nioneo.store.StoreId |
getClusterStoreId(org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode) |
protected org.neo4j.kernel.impl.nioneo.store.StoreId |
getClusterStoreId(org.apache.zookeeper.ZooKeeper keeper,
String clusterName) |
int |
getCurrentMasterNotify() |
String |
getHaServer() |
protected Machine |
getHaServer(int machineId,
boolean wait) |
protected Iterable<Machine> |
getHaServers() |
protected ZooKeeperMachine |
getMasterBasedOn(Collection<ZooKeeperMachine> machines) |
protected int |
getMyMachineId() |
protected int |
getNumberOfServers() |
String |
getRoot() |
protected String |
getSequenceNr() |
protected int |
getSessionTimeout() |
protected org.neo4j.kernel.impl.nioneo.store.StoreId |
getStoreId() |
org.apache.zookeeper.ZooKeeper |
getZooKeeper(boolean sync) |
protected int |
idFromPath(String path) |
void |
init() |
protected void |
invalidateMaster() |
protected void |
masterElectionHappened(Machine previousMaster,
Machine newMaster) |
protected org.neo4j.helpers.Pair<Integer,Integer> |
parseChild(String child) |
protected org.neo4j.helpers.Pair<Long,Integer> |
readDataRepresentingInstance(String path) |
protected Machine |
readHaServer(int machineId,
boolean wait) |
protected void |
refreshHaServers() |
String |
refreshMasterFromZooKeeper()
Tries to discover the master from the zookeeper information.
|
void |
removeCompatibilityModeListener(CompatibilityModeListener listener) |
protected void |
setDataChangeWatcher(String child,
int currentMasterId) |
protected void |
setDataChangeWatcher(String child,
int currentMasterId,
boolean skipOnSame)
Writes into one of master-notify or master-rebound the value given.
|
void |
shutdown() |
void |
start() |
void |
stop() |
protected void |
subscribeToChildrenChangeWatcher(String child) |
protected void |
subscribeToDataChangeWatcher(String child) |
String |
toString() |
void |
waitForSyncConnected() |
protected static final String HA_SERVERS_CHILD
protected static final String FLUSH_REQUESTED_CHILD
protected static final String COMPATIBILITY_CHILD_18
protected static final String COMPATIBILITY_CHILD_19
protected static final int STOP_FLUSHING
protected volatile Machine cachedMaster
protected final org.neo4j.kernel.impl.util.StringLogger msgLog
public static final Machine NO_MACHINE
public ZooClient(org.neo4j.kernel.impl.util.StringLogger stringLogger,
org.neo4j.kernel.configuration.Config conf)
public void init()
throws Throwable
init in interface org.neo4j.kernel.lifecycle.LifecycleThrowablepublic void start()
throws Throwable
start in interface org.neo4j.kernel.lifecycle.LifecycleThrowablepublic void stop()
throws Throwable
stop in interface org.neo4j.kernel.lifecycle.LifecycleThrowablepublic void shutdown()
shutdown in interface org.neo4j.kernel.lifecycle.Lifecyclepublic String refreshMasterFromZooKeeper()
Pair of a Master and the Machine it resides
on. If the new master is different than the current then the current is
invalidated and if allowChange is set to true then the a connection to
the new master is established otherwise a NO_MASTER is returned.protected void invalidateMaster()
public Machine getCachedMaster()
protected org.neo4j.kernel.impl.nioneo.store.StoreId getStoreId()
protected int getMyMachineId()
protected void subscribeToDataChangeWatcher(String child)
protected void subscribeToChildrenChangeWatcher(String child)
protected void setDataChangeWatcher(String child, int currentMasterId)
protected void setDataChangeWatcher(String child, int currentMasterId, boolean skipOnSame)
child - The node to write tocurrentMasterId - The value to writeskipOnSame - If true, then if the existing value is the same as currentMasterId nothing
will be written.public String getRoot()
public int getCurrentMasterNotify()
protected void masterElectionHappened(Machine previousMaster, Machine newMaster)
public org.apache.zookeeper.ZooKeeper getZooKeeper(boolean sync)
public org.neo4j.kernel.impl.nioneo.store.StoreId getClusterStoreId(org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode)
protected org.neo4j.kernel.impl.nioneo.store.StoreId getClusterStoreId(org.apache.zookeeper.ZooKeeper keeper,
String clusterName)
protected String asRootPath(org.neo4j.kernel.impl.nioneo.store.StoreId storeId)
protected org.neo4j.helpers.Pair<Long,Integer> readDataRepresentingInstance(String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionprotected String getSequenceNr()
public void addZooListener(ZooListener zooListener)
public void addCompatibilityModeListener(CompatibilityModeListener listener)
addCompatibilityModeListener in interface CompatibilityMonitorpublic void removeCompatibilityModeListener(CompatibilityModeListener listener)
removeCompatibilityModeListener in interface CompatibilityMonitorprotected ZooKeeperMachine getMasterBasedOn(Collection<ZooKeeperMachine> machines)
protected Map<Integer,ZooKeeperMachine> getAllMachines(boolean wait)
protected Map<Integer,ZooKeeperMachine> getAllMachines(boolean wait, org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode)
protected Map<Integer,ZooKeeperMachine> getAllMachinesInner(boolean wait, org.neo4j.kernel.ha.cluster.zoo.ZooClient.WaitMode mode)
protected Machine getHaServer(int machineId, boolean wait)
public String getClusterServer()
public String getHaServer()
protected void refreshHaServers()
throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperExceptionprotected int getNumberOfServers()
protected Machine readHaServer(int machineId, boolean wait)
public final void waitForSyncConnected()
protected int getSessionTimeout()
protected int idFromPath(String path)
Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.