Interface LifeCycleHook
- All Known Implementing Classes:
TinkerFactoryDataLoader
public interface LifeCycleHook
Provides a method in which users can hook into the startup and shutdown lifecycle of Gremlin Server. Creating
an instance of this interface in a Gremlin Server initialization script enables the ability to get a callback
when the server starts and stops. The hook is guaranteed to execute once at in both cases.
- Author:
- Stephen Mallette (http://stephen.genoprime.com)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classContains objects from the server that might be useful to scripting during the startup and shutdown process. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidCalled once after instantiation to pass configuration from thelifecycleHooksYAML section.voidCalled when the server is shutdown.voidCalled when the server starts up.
-
Method Details
-
init
Called once after instantiation to pass configuration from thelifecycleHooksYAML section. Implementations that require configuration should override this method. The default implementation is a no-op so that existing hooks are not forced to implement it.If this method throws an exception, the hook is skipped and the server continues to start without it.
- Parameters:
config- the key/value pairs from theconfigblock in the YAML entry
-
onStartUp
Called when the server starts up. The graph collection will have been initialized at this point and all initialization scripts will have been executed when this callback is called.If this method throws an exception (other than
UnsupportedOperationException), the server will fail to start. -
onShutDown
Called when the server is shutdown.If this method throws an exception, remaining shutdown hooks and graph cleanup may be skipped.
-