All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rythmengine.GaeShutdownService Maven / Gradle / Ivy

Go to download

A strong typed high performance Java Template engine with .Net Razor like syntax

There is a newer version: 1.4.2
Show newest version
/**
 * Copyright (C) 2013-2016 The Rythm Engine project
 * for LICENSE and other details see:
 * https://github.com/rythmengine/rythmengine
 */
package org.rythmengine;

import com.google.appengine.api.LifecycleManager;

enum GaeShutdownService implements ShutdownService {

    INSTANCE;

    @Override
    public void setShutdown(final Runnable runnable) {
        try {
            LifecycleManager.getInstance().setShutdownHook(new LifecycleManager.ShutdownHook() {
                @Override
                public void shutdown() {
                    if (runnable != null) {
                        runnable.run();
                    }
                }
            });
        } catch (Throwable t) {
            // Nothing to do
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy