appengine-java-vm-runtime icon indicating copy to clipboard operation
appengine-java-vm-runtime copied to clipboard

Shutdown Hook

Open erugeri opened this issue 10 years ago • 0 comments

We'd really appreciate to be able to have a shutdown hook in order to clean server state (destroying connection pool to redis, to cassandra, emptying caches not yet persisted...) before shutdown.

However we didn't find any way to do so. We tried 2 solutions:

JVM way:

Runtime.getRuntime().addShutdownHook(new Thread() {
    public void run() {
        // cleaning
    }
});

App Engine Sandbox way:

LifecycleManager.getInstance().setShutdownHook(new ShutdownHook() {
    public void shutdown() {
        // cleaning
    }
});

None seemed to work :( If you have any idea... Thanks!

erugeri avatar Aug 10 '15 09:08 erugeri