com.tinkerpop.rexster
Class ShutdownManager

java.lang.Object
  extended by com.tinkerpop.rexster.ShutdownManager

public class ShutdownManager
extends Object

Manages the socket listening for incoming shutdown requests.

Adapted from http://code.google.com/p/shutdown-listener/


Nested Class Summary
static interface ShutdownManager.ShutdownListener
           
 
Field Summary
static String COMMAND_SHUTDOWN_NO_WAIT
           
static String COMMAND_SHUTDOWN_WAIT
           
static String COMMAND_STATUS
           
protected  Collection<ShutdownManager.ShutdownListener> internalShutdownListeners
           
protected  org.apache.log4j.Logger logger
           
protected  Collection<ShutdownManager.ShutdownListener> shutdownListeners
           
 
Constructor Summary
ShutdownManager(String host, int port)
           
 
Method Summary
protected  void postShutdownListeners()
          Called after the shutdown listeners, before threads waiting on waitForShutdown() are released
protected  void preShutdownListeners()
          Called before the shutdown listeners
 void registerShutdownListener(ShutdownManager.ShutdownListener shutdownListener)
           
protected  void runShutdownHandlers(Collection<ShutdownManager.ShutdownListener> shutdownListeners)
           
 void shutdown()
          Calls shutdown hooks and cleans up shutdown listener code, notifies all waiting threads on completion
protected  void sortShutdownListeners(List<ShutdownManager.ShutdownListener> shutdownListeners)
          Sort a List of ShutdownManager.ShutdownSocketListener before runShutdownHandlers(Collection) iterates over them.
 void start()
           
 void waitForShutdown()
          If shutdown isn't complete will wait on the shutdown lock for shutdown to complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.log4j.Logger logger

internalShutdownListeners

protected final Collection<ShutdownManager.ShutdownListener> internalShutdownListeners

shutdownListeners

protected Collection<ShutdownManager.ShutdownListener> shutdownListeners

COMMAND_SHUTDOWN_WAIT

public static final String COMMAND_SHUTDOWN_WAIT
See Also:
Constant Field Values

COMMAND_SHUTDOWN_NO_WAIT

public static final String COMMAND_SHUTDOWN_NO_WAIT
See Also:
Constant Field Values

COMMAND_STATUS

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

ShutdownManager

public ShutdownManager(String host,
                       int port)
Method Detail

registerShutdownListener

public void registerShutdownListener(ShutdownManager.ShutdownListener shutdownListener)

start

public final void start()
                 throws Exception
Throws:
Exception

waitForShutdown

public final void waitForShutdown()
If shutdown isn't complete will wait on the shutdown lock for shutdown to complete. DOES NOT TRIGGER SHUTDOWN


shutdown

public final void shutdown()
Calls shutdown hooks and cleans up shutdown listener code, notifies all waiting threads on completion


preShutdownListeners

protected void preShutdownListeners()
Called before the shutdown listeners


postShutdownListeners

protected void postShutdownListeners()
Called after the shutdown listeners, before threads waiting on waitForShutdown() are released


sortShutdownListeners

protected void sortShutdownListeners(List<ShutdownManager.ShutdownListener> shutdownListeners)
Sort a List of ShutdownManager.ShutdownSocketListener before runShutdownHandlers(Collection) iterates over them. Default implementation does nothing


runShutdownHandlers

protected final void runShutdownHandlers(Collection<ShutdownManager.ShutdownListener> shutdownListeners)


Copyright © 2009-2012. All Rights Reserved.