Neo4j Enterprise

org.neo4j.kernel
Class HighlyAvailableGraphDatabase

java.lang.Object
  extended by org.neo4j.kernel.AbstractGraphDatabase
      extended by org.neo4j.kernel.HighlyAvailableGraphDatabase
All Implemented Interfaces:
GraphDatabaseService, ResponseReceiver

public class HighlyAvailableGraphDatabase
extends AbstractGraphDatabase
implements GraphDatabaseService, ResponseReceiver


Field Summary
static String CONFIG_KEY_ALLOW_INIT_CLUSTER
           
static String CONFIG_KEY_BRANCHED_DATA_POLICY
           
static String CONFIG_KEY_CLUSTER_NAME
           
static String CONFIG_KEY_COORDINATORS
           
static String CONFIG_KEY_MAX_CONCURRENT_CHANNELS_PER_SLAVE
           
static String CONFIG_KEY_OLD_COORDINATORS
           
static String CONFIG_KEY_OLD_SERVER_ID
           
static String CONFIG_KEY_PULL_INTERVAL
           
static String CONFIG_KEY_READ_TIMEOUT
           
static String CONFIG_KEY_SERVER
           
static String CONFIG_KEY_SERVER_ID
           
static String CONFIG_KEY_SLAVE_COORDINATOR_UPDATE_MODE
           
 
Constructor Summary
HighlyAvailableGraphDatabase(String storeDir, Map<String,String> config)
          Will instantiate its own ZooKeeper broker
HighlyAvailableGraphDatabase(String storeDir, Map<String,String> config, BrokerFactory brokerFactory)
          Only for testing (and BackupFromHaCluster)
 
Method Summary
 Transaction beginTx()
          Starts a new transaction and associates it with the current thread.
 Node createNode()
          Creates a new node.
 Iterable<Node> getAllNodes()
          Returns all nodes in the node space.
 Broker getBroker()
           
 Config getConfig()
           
<T> Collection<T>
getManagementBeans(Class<T> type)
           
 MasterServer getMasterServerIfMaster()
           
 Node getNodeById(long id)
          Looks up a node by id.
 Node getReferenceNode()
          Returns the reference node, which is a "starting point" in the node space.
 Relationship getRelationshipById(long id)
          Looks up a relationship by id.
 Iterable<RelationshipType> getRelationshipTypes()
          Returns all relationship types currently in the underlying store.
 SlaveContext getSlaveContext(int eventIdentifier)
           
 String getStoreDir()
           
 IndexManager index()
          Returns the IndexManager paired with this graph database service and is the entry point for managing indexes coupled with this database.
 void internalShutdown(boolean rotateLogs)
           
 boolean isMaster()
           
 boolean isReadOnly()
           
static Map<String,String> loadConfigurations(String file)
           
 void newMaster(Pair<Master,Machine> master, Exception e)
           
 void pullUpdates()
           
<T> T
receive(Response<T> response)
           
protected  void reevaluateMyself(Pair<Master,Machine> master, org.neo4j.kernel.impl.nioneo.store.StoreId storeId)
           
 KernelEventHandler registerKernelEventHandler(KernelEventHandler handler)
          Registers handler as a handler for kernel events which are generated from different places in the lifecycle of the kernel.
<T> TransactionEventHandler<T>
registerTransactionEventHandler(TransactionEventHandler<T> handler)
          Registers handler as a handler for transaction events which are generated from different places in the lifecycle of each transaction.
 void shutdown()
          Shuts down Neo4j.
 void shutdownBroker()
           
 KernelEventHandler unregisterKernelEventHandler(KernelEventHandler handler)
          Unregisters handler from the list of kernel event handlers.
<T> TransactionEventHandler<T>
unregisterTransactionEventHandler(TransactionEventHandler<T> handler)
          Unregisters handler from the list of transaction event handlers.
 
Methods inherited from class org.neo4j.kernel.AbstractGraphDatabase
getManagementBean, getSingleManagementBean, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_KEY_OLD_SERVER_ID

public static final String CONFIG_KEY_OLD_SERVER_ID
See Also:
Constant Field Values

CONFIG_KEY_SERVER_ID

public static final String CONFIG_KEY_SERVER_ID
See Also:
Constant Field Values

CONFIG_KEY_OLD_COORDINATORS

public static final String CONFIG_KEY_OLD_COORDINATORS
See Also:
Constant Field Values

CONFIG_KEY_COORDINATORS

public static final String CONFIG_KEY_COORDINATORS
See Also:
Constant Field Values

CONFIG_KEY_SERVER

public static final String CONFIG_KEY_SERVER
See Also:
Constant Field Values

CONFIG_KEY_CLUSTER_NAME

public static final String CONFIG_KEY_CLUSTER_NAME
See Also:
Constant Field Values

CONFIG_KEY_PULL_INTERVAL

public static final String CONFIG_KEY_PULL_INTERVAL
See Also:
Constant Field Values

CONFIG_KEY_ALLOW_INIT_CLUSTER

public static final String CONFIG_KEY_ALLOW_INIT_CLUSTER
See Also:
Constant Field Values

CONFIG_KEY_MAX_CONCURRENT_CHANNELS_PER_SLAVE

public static final String CONFIG_KEY_MAX_CONCURRENT_CHANNELS_PER_SLAVE
See Also:
Constant Field Values

CONFIG_KEY_BRANCHED_DATA_POLICY

public static final String CONFIG_KEY_BRANCHED_DATA_POLICY
See Also:
Constant Field Values

CONFIG_KEY_READ_TIMEOUT

public static final String CONFIG_KEY_READ_TIMEOUT
See Also:
Constant Field Values

CONFIG_KEY_SLAVE_COORDINATOR_UPDATE_MODE

public static final String CONFIG_KEY_SLAVE_COORDINATOR_UPDATE_MODE
See Also:
Constant Field Values
Constructor Detail

HighlyAvailableGraphDatabase

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


HighlyAvailableGraphDatabase

public HighlyAvailableGraphDatabase(String storeDir,
                                    Map<String,String> config,
                                    BrokerFactory brokerFactory)
Only for testing (and BackupFromHaCluster)

Method Detail

loadConfigurations

public static Map<String,String> loadConfigurations(String file)

getBroker

public Broker getBroker()

pullUpdates

public void pullUpdates()

getConfig

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

getStoreDir

public String getStoreDir()
Specified by:
getStoreDir in class AbstractGraphDatabase

getManagementBeans

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

reevaluateMyself

protected void reevaluateMyself(Pair<Master,Machine> master,
                                org.neo4j.kernel.impl.nioneo.store.StoreId storeId)

beginTx

public Transaction beginTx()
Description copied from interface: GraphDatabaseService
Starts a new transaction and associates it with the current thread.

Specified by:
beginTx in interface GraphDatabaseService
Returns:
a new transaction instance

createNode

public Node createNode()
Description copied from interface: GraphDatabaseService
Creates a new node.

Specified by:
createNode in interface GraphDatabaseService
Returns:
the created node.

getAllNodes

public Iterable<Node> getAllNodes()
Description copied from interface: GraphDatabaseService
Returns all nodes in the node space.

Specified by:
getAllNodes in interface GraphDatabaseService
Returns:
all nodes in the node space

getNodeById

public Node getNodeById(long id)
Description copied from interface: GraphDatabaseService
Looks up a node by id.

Specified by:
getNodeById in interface GraphDatabaseService
Parameters:
id - the id of the node
Returns:
the node with id id if found

getReferenceNode

public Node getReferenceNode()
Description copied from interface: GraphDatabaseService
Returns the reference node, which is a "starting point" in the node space. Usually, a client attaches relationships to this node that leads into various parts of the node space. For more information about common node space organizational patterns, see the design guide at wiki.neo4j.org/content/Design_Guide.

Specified by:
getReferenceNode in interface GraphDatabaseService
Returns:
the reference node

getRelationshipById

public Relationship getRelationshipById(long id)
Description copied from interface: GraphDatabaseService
Looks up a relationship by id.

Specified by:
getRelationshipById in interface GraphDatabaseService
Parameters:
id - the id of the relationship
Returns:
the relationship with id id if found

getRelationshipTypes

public Iterable<RelationshipType> getRelationshipTypes()
Description copied from interface: GraphDatabaseService
Returns all relationship types currently in the underlying store. Relationship types are added to the underlying store the first time they are used in a successfully commited node.createRelationshipTo(...). Note that this method is guaranteed to return all known relationship types, but it does not guarantee that it won't return more than that (e.g. it can return "historic" relationship types that no longer have any relationships in the node space).

Specified by:
getRelationshipTypes in interface GraphDatabaseService
Returns:
all relationship types in the underlying store

registerKernelEventHandler

public KernelEventHandler registerKernelEventHandler(KernelEventHandler handler)
Description copied from interface: GraphDatabaseService
Registers handler as a handler for kernel events which are generated from different places in the lifecycle of the kernel. To guarantee proper behaviour the handler should be registered right after the graph database has been started. If the specified handler instance has already been registered this method will do nothing.

Specified by:
registerKernelEventHandler in interface GraphDatabaseService
Parameters:
handler - the handler to receive events about different states in the kernel lifecycle.
Returns:
the handler passed in as the argument.

registerTransactionEventHandler

public <T> TransactionEventHandler<T> registerTransactionEventHandler(TransactionEventHandler<T> handler)
Description copied from interface: GraphDatabaseService
Registers handler as a handler for transaction events which are generated from different places in the lifecycle of each transaction. To guarantee that the handler gets all events properly it shouldn't be registered when the application is running (i.e. in the middle of one or more transactions). If the specified handler instance has already been registered this method will do nothing.

Specified by:
registerTransactionEventHandler in interface GraphDatabaseService
Type Parameters:
T - the type of state object used in the handler, see more documentation about it at TransactionEventHandler.
Parameters:
handler - the handler to receive events about different states in transaction lifecycles.
Returns:
the handler passed in as the argument.

internalShutdown

public void internalShutdown(boolean rotateLogs)

shutdown

public void shutdown()
Description copied from interface: GraphDatabaseService
Shuts down Neo4j. After this method has been invoked, it's invalid to invoke any methods in the Neo4j API and all references to this instance of GraphDatabaseService should be discarded.

Specified by:
shutdown in interface GraphDatabaseService

unregisterKernelEventHandler

public KernelEventHandler unregisterKernelEventHandler(KernelEventHandler handler)
Description copied from interface: GraphDatabaseService
Unregisters handler from the list of kernel event handlers. If handler hasn't been registered with GraphDatabaseService.registerKernelEventHandler(KernelEventHandler) prior to calling this method an IllegalStateException will be thrown. After a successful call to this method the handler will no longer receive any kernel events.

Specified by:
unregisterKernelEventHandler in interface GraphDatabaseService
Parameters:
handler - the handler to receive events about different states in the kernel lifecycle.
Returns:
the handler passed in as the argument.

unregisterTransactionEventHandler

public <T> TransactionEventHandler<T> unregisterTransactionEventHandler(TransactionEventHandler<T> handler)
Description copied from interface: GraphDatabaseService
Unregisters handler from the list of transaction event handlers. If handler hasn't been registered with GraphDatabaseService.registerTransactionEventHandler(TransactionEventHandler) prior to calling this method an IllegalStateException will be thrown. After a successful call to this method the handler will no longer receive any transaction events.

Specified by:
unregisterTransactionEventHandler in interface GraphDatabaseService
Type Parameters:
T - the type of state object used in the handler, see more documentation about it at TransactionEventHandler.
Parameters:
handler - the handler to receive events about different states in transaction lifecycles.
Returns:
the handler passed in as the argument.

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

newMaster

public void newMaster(Pair<Master,Machine> master,
                      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 AbstractGraphDatabase

index

public IndexManager index()
Description copied from interface: GraphDatabaseService
Returns the IndexManager paired with this graph database service and is the entry point for managing indexes coupled with this database.

Specified by:
index in interface GraphDatabaseService
Returns:
the IndexManager for this database.

shutdownBroker

public void shutdownBroker()

Neo4j Enterprise

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