Neo4j Enterprise

org.neo4j.kernel
Class AvailabilityGuard

java.lang.Object
  extended by org.neo4j.kernel.AvailabilityGuard

public class AvailabilityGuard
extends Object

The availability guard is what ensures that the database will only take calls when it is in an ok state. It allows query handling to easily determine if it is ok to call the database by calling isAvailable(long).

The implementation uses an atomic integer that is initialized to the nr of conditions that must be met for the database to be available. Each such condition will then call grant/deny accordingly, and if the integer becomes 0 access is granted.


Nested Class Summary
static interface AvailabilityGuard.AvailabilityListener
           
 
Constructor Summary
AvailabilityGuard(Clock clock, int conditionCount)
           
 
Method Summary
 void addListener(AvailabilityGuard.AvailabilityListener listener)
           
 void deny()
           
 void grant()
           
 boolean isAvailable(long millis)
          Determines if the database is available for transactions to use.
 void removeListener(AvailabilityGuard.AvailabilityListener listener)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvailabilityGuard

public AvailabilityGuard(Clock clock,
                         int conditionCount)
Method Detail

deny

public void deny()

grant

public void grant()

shutdown

public void shutdown()

isAvailable

public boolean isAvailable(long millis)
Determines if the database is available for transactions to use.

Parameters:
millis - to wait if not yet available.
Returns:
true if it is available, otherwise false. Returns false immediately if shutdown.

addListener

public void addListener(AvailabilityGuard.AvailabilityListener listener)

removeListener

public void removeListener(AvailabilityGuard.AvailabilityListener listener)

Neo4j Enterprise

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