4.14.2.1 Starting and Stopping the PGX Engine

You can start the graph server (PGX ) from the application by making a call to instance.startEngine() which takes a JSON object as an argument for PGX configuration.

Note:

Stopping the PGX Engine

You can stop the PGX engine using one of the following APIs:

instance.shutdownEngineNow(); // cancels pending tasks, throws exception if engine is not running
instance.shutdownEngineNowIfRunning(); // cancels pending tasks, only tries to shut down if engine is running
if (instance.shutdownEngine(30, TimeUnit.SECONDS) == false) { 
  // doesn't accept new tasks but finishes up remaining tasks
  // pending tasks didn't finish after 30 seconds
}

Note:

Shutting down the PGX engine keeps the Apache Tomcat server alive, but new sessions cannot be created. Also, all the current sessions and tasks will be cancelled and terminated.