org.neo4j.kernel
Class HAGraphDb

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

public class HAGraphDb
extends org.neo4j.kernel.AbstractGraphDatabase
implements org.neo4j.graphdb.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 and ClusterClient
HAGraphDb(String storeDir, Map<String,String> config, BrokerFactory brokerFactory)
          ONLY FOR TESTING Will instantiate its own ClusterClient
HAGraphDb(String storeDir, Map<String,String> config, BrokerFactory brokerFactory, ClusterClient clusterManager)
          ONLY FOR TESTING
 
Method Summary
 org.neo4j.graphdb.Transaction beginTx()
           
 org.neo4j.graphdb.Node createNode()
           
 Iterable<org.neo4j.graphdb.Node> getAllNodes()
           
 Broker getBroker()
           
 org.neo4j.kernel.Config getConfig()
           
<T> Collection<T>
getManagementBeans(Class<T> type)
           
 MasterServer getMasterServerIfMaster()
           
 org.neo4j.graphdb.Node getNodeById(long id)
           
 org.neo4j.graphdb.Node getReferenceNode()
           
 org.neo4j.graphdb.Relationship getRelationshipById(long id)
           
 Iterable<org.neo4j.graphdb.RelationshipType> getRelationshipTypes()
           
 SlaveContext getSlaveContext(int eventIdentifier)
           
 String getStoreDir()
           
 void handle(Exception e)
           
 org.neo4j.graphdb.index.IndexManager index()
           
 void internalShutdown(boolean rotateLogs)
           
 boolean isMaster()
           
 boolean isReadOnly()
           
 void newMaster(Exception e)
           
 void pullUpdates()
           
<T> T
receive(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)
           
 org.neo4j.graphdb.event.KernelEventHandler registerKernelEventHandler(org.neo4j.graphdb.event.KernelEventHandler handler)
           
<T> org.neo4j.graphdb.event.TransactionEventHandler<T>
registerTransactionEventHandler(org.neo4j.graphdb.event.TransactionEventHandler<T> handler)
           
 void shutdown()
           
 void shutdownBroker()
           
 String toString()
           
 org.neo4j.graphdb.event.KernelEventHandler unregisterKernelEventHandler(org.neo4j.graphdb.event.KernelEventHandler handler)
           
<T> org.neo4j.graphdb.event.TransactionEventHandler<T>
unregisterTransactionEventHandler(org.neo4j.graphdb.event.TransactionEventHandler<T> handler)
           
 
Methods inherited from class org.neo4j.kernel.AbstractGraphDatabase
getManagementBean, getSingleManagementBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HAGraphDb

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


HAGraphDb

public HAGraphDb(String storeDir,
                 Map<String,String> config,
                 BrokerFactory brokerFactory)
ONLY FOR TESTING Will instantiate its own ClusterClient


HAGraphDb

public HAGraphDb(String storeDir,
                 Map<String,String> config,
                 BrokerFactory brokerFactory,
                 ClusterClient clusterManager)
ONLY FOR TESTING

Method Detail

getBroker

public Broker getBroker()

pullUpdates

public void pullUpdates()

getConfig

public org.neo4j.kernel.Config getConfig()
Specified by:
getConfig in class org.neo4j.kernel.AbstractGraphDatabase

getStoreDir

public String getStoreDir()
Specified by:
getStoreDir in class org.neo4j.kernel.AbstractGraphDatabase

getManagementBeans

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

toString

public String toString()
Overrides:
toString in class org.neo4j.kernel.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. The cluster manager is not used outside of startup where this call should not happen and also it doesn't keep a zoo client open - so is no reason to recreate it

Specified by:
reconnect in interface ResponseReceiver

reevaluateMyself

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

beginTx

public org.neo4j.graphdb.Transaction beginTx()
Specified by:
beginTx in interface org.neo4j.graphdb.GraphDatabaseService

createNode

public org.neo4j.graphdb.Node createNode()
Specified by:
createNode in interface org.neo4j.graphdb.GraphDatabaseService

getAllNodes

public Iterable<org.neo4j.graphdb.Node> getAllNodes()
Specified by:
getAllNodes in interface org.neo4j.graphdb.GraphDatabaseService

getNodeById

public org.neo4j.graphdb.Node getNodeById(long id)
Specified by:
getNodeById in interface org.neo4j.graphdb.GraphDatabaseService

getReferenceNode

public org.neo4j.graphdb.Node getReferenceNode()
Specified by:
getReferenceNode in interface org.neo4j.graphdb.GraphDatabaseService

getRelationshipById

public org.neo4j.graphdb.Relationship getRelationshipById(long id)
Specified by:
getRelationshipById in interface org.neo4j.graphdb.GraphDatabaseService

getRelationshipTypes

public Iterable<org.neo4j.graphdb.RelationshipType> getRelationshipTypes()
Specified by:
getRelationshipTypes in interface org.neo4j.graphdb.GraphDatabaseService

registerKernelEventHandler

public org.neo4j.graphdb.event.KernelEventHandler registerKernelEventHandler(org.neo4j.graphdb.event.KernelEventHandler handler)
Specified by:
registerKernelEventHandler in interface org.neo4j.graphdb.GraphDatabaseService

registerTransactionEventHandler

public <T> org.neo4j.graphdb.event.TransactionEventHandler<T> registerTransactionEventHandler(org.neo4j.graphdb.event.TransactionEventHandler<T> handler)
Specified by:
registerTransactionEventHandler in interface org.neo4j.graphdb.GraphDatabaseService

internalShutdown

public void internalShutdown(boolean rotateLogs)

shutdown

public void shutdown()
Specified by:
shutdown in interface org.neo4j.graphdb.GraphDatabaseService

unregisterKernelEventHandler

public org.neo4j.graphdb.event.KernelEventHandler unregisterKernelEventHandler(org.neo4j.graphdb.event.KernelEventHandler handler)
Specified by:
unregisterKernelEventHandler in interface org.neo4j.graphdb.GraphDatabaseService

unregisterTransactionEventHandler

public <T> org.neo4j.graphdb.event.TransactionEventHandler<T> unregisterTransactionEventHandler(org.neo4j.graphdb.event.TransactionEventHandler<T> handler)
Specified by:
unregisterTransactionEventHandler in interface org.neo4j.graphdb.GraphDatabaseService

getSlaveContext

public SlaveContext getSlaveContext(int eventIdentifier)
Specified by:
getSlaveContext in interface ResponseReceiver

receive

public <T> T receive(Response<T> response)
Specified by:
receive in interface ResponseReceiver

handle

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

newMaster

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

getMasterServerIfMaster

public MasterServer getMasterServerIfMaster()

isMaster

public boolean isMaster()

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in class org.neo4j.kernel.AbstractGraphDatabase

index

public org.neo4j.graphdb.index.IndexManager index()
Specified by:
index in interface org.neo4j.graphdb.GraphDatabaseService

shutdownBroker

public void shutdownBroker()


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