org.neo4j.kernel
Class HAGraphDb

java.lang.Object
  extended by org.neo4j.kernel.AbstractGraphDatabase
      extended by org.neo4j.kernel.HAGraphDb
All Implemented Interfaces:
org.neo4j.com.Client.ConnectionLostHandler, GraphDatabaseService, ResponseReceiver

public class HAGraphDb
extends AbstractGraphDatabase
implements GraphDatabaseService, ResponseReceiver


Field Summary
 
Fields inherited from interface org.neo4j.com.Client.ConnectionLostHandler
NO_ACTION
 
Constructor Summary
HAGraphDb(String storeDir, Map<String,String> config)
          Will instantiate its own ZooKeeper broker
HAGraphDb(String storeDir, Map<String,String> config, BrokerFactory brokerFactory)
          Only for testing
 
Method Summary
protected  void close()
           
 Node createNode()
           
 Broker getBroker()
           
 Config getConfig()
           
 KernelData getKernelData()
           
<T> Collection<T>
getManagementBeans(Class<T> type)
           
 MasterServer getMasterServerIfMaster()
           
 Node getNodeById(long id)
           
 Node getReferenceNode()
           
 Relationship getRelationshipById(long id)
           
 org.neo4j.com.SlaveContext getSlaveContext(int eventIdentifier)
          Returns a SlaveContext instance that has eventIdentifier as the event identifier.
 void handle(Exception e)
           
 IndexManager index()
           
 void internalShutdown(boolean rotateLogs)
           
 boolean isMaster()
           
 void newMaster(Exception e)
           
 void pullUpdates()
           
<T> T
receive(org.neo4j.com.Response<T> response)
           
 void reconnect(Exception e)
          Shuts down the broker, invalidating every connection to the zookeeper cluster and starts it again.
protected  void reevaluateMyself(org.neo4j.kernel.impl.nioneo.store.StoreId storeId)
           
 KernelEventHandler registerKernelEventHandler(KernelEventHandler handler)
           
<T> TransactionEventHandler<T>
registerTransactionEventHandler(TransactionEventHandler<T> handler)
           
 void shutdownBroker()
           
 String toString()
           
 TransactionBuilder tx()
           
 KernelEventHandler unregisterKernelEventHandler(KernelEventHandler handler)
           
<T> TransactionEventHandler<T>
unregisterTransactionEventHandler(TransactionEventHandler<T> handler)
           
 
Methods inherited from class org.neo4j.kernel.AbstractGraphDatabase
beginTx, createStringLogger, getAllNodes, getManagementBean, getMessageLog, getRelationshipTypes, getSingleManagementBean, getStoreDir, isEphemeral, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.neo4j.graphdb.GraphDatabaseService
beginTx, getAllNodes, getRelationshipTypes, shutdown
 

Constructor Detail

HAGraphDb

public HAGraphDb(String storeDir,
                 Map<String,String> config)
Will instantiate its own ZooKeeper broker


HAGraphDb

public HAGraphDb(String storeDir,
                 Map<String,String> config,
                 BrokerFactory brokerFactory)
Only for testing

Method Detail

getBroker

public Broker getBroker()

pullUpdates

public void pullUpdates()

getConfig

public Config getConfig()
Specified by:
getConfig in class AbstractGraphDatabase

getManagementBeans

public <T> Collection<T> getManagementBeans(Class<T> type)
Specified by:
getManagementBeans in class AbstractGraphDatabase

toString

public String toString()
Overrides:
toString in class AbstractGraphDatabase

reconnect

public void reconnect(Exception e)
Shuts down the broker, invalidating every connection to the zookeeper cluster and starts it again. Should be called in case a ConnectionExpired event is received, this is the equivalent of building the ZK connection from start. Also triggers a master reelect, to make sure that the state ZK ended up in during our absence is respected.

Specified by:
reconnect in interface ResponseReceiver

reevaluateMyself

protected void reevaluateMyself(org.neo4j.kernel.impl.nioneo.store.StoreId storeId)

tx

public TransactionBuilder tx()
Specified by:
tx in class AbstractGraphDatabase

createNode

public Node createNode()
Specified by:
createNode in interface GraphDatabaseService

getNodeById

public Node getNodeById(long id)
Specified by:
getNodeById in interface GraphDatabaseService

getReferenceNode

public Node getReferenceNode()
Specified by:
getReferenceNode in interface GraphDatabaseService

getRelationshipById

public Relationship getRelationshipById(long id)
Specified by:
getRelationshipById in interface GraphDatabaseService

registerKernelEventHandler

public KernelEventHandler registerKernelEventHandler(KernelEventHandler handler)
Specified by:
registerKernelEventHandler in interface GraphDatabaseService

registerTransactionEventHandler

public <T> TransactionEventHandler<T> registerTransactionEventHandler(TransactionEventHandler<T> handler)
Specified by:
registerTransactionEventHandler in interface GraphDatabaseService

internalShutdown

public void internalShutdown(boolean rotateLogs)

close

protected void close()
Specified by:
close in class AbstractGraphDatabase

unregisterKernelEventHandler

public KernelEventHandler unregisterKernelEventHandler(KernelEventHandler handler)
Specified by:
unregisterKernelEventHandler in interface GraphDatabaseService

unregisterTransactionEventHandler

public <T> TransactionEventHandler<T> unregisterTransactionEventHandler(TransactionEventHandler<T> handler)
Specified by:
unregisterTransactionEventHandler in interface GraphDatabaseService

getSlaveContext

public org.neo4j.com.SlaveContext getSlaveContext(int eventIdentifier)
Description copied from interface: ResponseReceiver
Returns a SlaveContext instance that has eventIdentifier as the event identifier.

Specified by:
getSlaveContext in interface ResponseReceiver
Parameters:
eventIdentifier - The event identifier of the returned slave context
Returns:
The slave context

receive

public <T> T receive(org.neo4j.com.Response<T> response)
Specified by:
receive in interface ResponseReceiver

handle

public void handle(Exception e)
Specified by:
handle in interface org.neo4j.com.Client.ConnectionLostHandler

newMaster

public void newMaster(Exception e)
Specified by:
newMaster in interface ResponseReceiver

getMasterServerIfMaster

public MasterServer getMasterServerIfMaster()

isMaster

public boolean isMaster()

index

public IndexManager index()
Specified by:
index in interface GraphDatabaseService

shutdownBroker

public void shutdownBroker()

getKernelData

public KernelData getKernelData()
Specified by:
getKernelData in class AbstractGraphDatabase


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.