Search in sources :

Example 1 with AutoDisposeSingleThreadScheduler

use of net.dempsy.util.executor.AutoDisposeSingleThreadScheduler in project Dempsy by Dempsy.

the class NodeManager method getThePlug.

@Override
public ThePlug getThePlug() {
    return () -> {
        try {
            // we are going to go down no matter what!
            final var scheduler = new AutoDisposeSingleThreadScheduler("shutdown-timer");
            scheduler.schedule(() -> {
                try {
                    LOGGER.error("Shutdown timer triggered. Hard exiting!");
                    ignore(() -> Thread.sleep(200));
                } finally {
                    System.exit(1);
                }
            }, 30, TimeUnit.SECONDS);
            stop();
        } catch (final Throwable th) {
            try {
                LOGGER.error("Failed shutting down!", th);
                ignore(() -> Thread.sleep(200));
            } finally {
                System.exit(1);
            }
        }
    };
}
Also used : AutoDisposeSingleThreadScheduler(net.dempsy.util.executor.AutoDisposeSingleThreadScheduler)

Example 2 with AutoDisposeSingleThreadScheduler

use of net.dempsy.util.executor.AutoDisposeSingleThreadScheduler in project Dempsy by Dempsy.

the class TestSimpleRoutingStrategy method setup.

@Before
public void setup() {
    sessFact = new LocalClusterSessionFactory();
    session = sessFact.createSession();
    sched = new AutoDisposeSingleThreadScheduler("test");
    infra = makeInfra(session, sched);
}
Also used : AutoDisposeSingleThreadScheduler(net.dempsy.util.executor.AutoDisposeSingleThreadScheduler) LocalClusterSessionFactory(net.dempsy.cluster.local.LocalClusterSessionFactory) Before(org.junit.Before)

Example 3 with AutoDisposeSingleThreadScheduler

use of net.dempsy.util.executor.AutoDisposeSingleThreadScheduler in project Dempsy by Dempsy.

the class BaseRouterTestWithSession method setup.

@Before
public void setup() throws ClusterInfoException, IOException {
    session = sessFact.createSession();
    sched = new AutoDisposeSingleThreadScheduler(testName + "-AutoDisposeSingleThreadScheduler");
    infra = makeInfra(session, sched);
}
Also used : AutoDisposeSingleThreadScheduler(net.dempsy.util.executor.AutoDisposeSingleThreadScheduler) Before(org.junit.Before)

Aggregations

AutoDisposeSingleThreadScheduler (net.dempsy.util.executor.AutoDisposeSingleThreadScheduler)3 Before (org.junit.Before)2 LocalClusterSessionFactory (net.dempsy.cluster.local.LocalClusterSessionFactory)1