Search in sources :

Example 6 with Lifecycle

use of org.neo4j.kernel.lifecycle.Lifecycle in project neo4j by neo4j.

the class Resources method managed.

public <T> T managed(T service) {
    Lifecycle lifecycle = null;
    if (service instanceof Lifecycle) {
        lifecycle = (Lifecycle) service;
    } else if (service instanceof AutoCloseable) {
        lifecycle = new Closer((AutoCloseable) service);
    }
    life.add(lifecycle);
    return service;
}
Also used : Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle)

Aggregations

Lifecycle (org.neo4j.kernel.lifecycle.Lifecycle)6 ExecutorService (java.util.concurrent.ExecutorService)2 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)2 Monitors (org.neo4j.kernel.monitoring.Monitors)2 Channel (io.netty.channel.Channel)1 SslContext (io.netty.handler.ssl.SslContext)1 SslContextBuilder (io.netty.handler.ssl.SslContextBuilder)1 InternalLoggerFactory (io.netty.util.internal.logging.InternalLoggerFactory)1 File (java.io.File)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 URI (java.net.URI)1 GeneralSecurityException (java.security.GeneralSecurityException)1 Clock (java.time.Clock)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1