Search in sources :

Example 1 with UnsatisfiedDependencyException

use of org.neo4j.kernel.impl.util.UnsatisfiedDependencyException in project neo4j by neo4j.

the class OnlineBackupKernelExtension method stop.

@Override
public void stop() throws Throwable {
    if (server != null) {
        server.stop();
        server.shutdown();
        server = null;
        try {
            graphDatabaseAPI.getDependencyResolver().resolveDependency(ClusterMemberEvents.class).removeClusterMemberListener((ClusterMemberListener) startBindingListener);
            graphDatabaseAPI.getDependencyResolver().resolveDependency(BindingNotifier.class).removeBindingListener((BindingListener) bindingListener);
            ClusterMemberAvailability client = getClusterMemberAvailability();
            client.memberIsUnavailable(BACKUP);
        } catch (NoClassDefFoundError | UnsatisfiedDependencyException e) {
        // Not running HA
        }
    }
}
Also used : ClusterMemberEvents(org.neo4j.cluster.member.ClusterMemberEvents) BindingNotifier(org.neo4j.cluster.com.BindingNotifier) UnsatisfiedDependencyException(org.neo4j.kernel.impl.util.UnsatisfiedDependencyException) ClusterMemberAvailability(org.neo4j.cluster.member.ClusterMemberAvailability)

Example 2 with UnsatisfiedDependencyException

use of org.neo4j.kernel.impl.util.UnsatisfiedDependencyException in project neo4j by neo4j.

the class KernelExtensions method init.

@Override
public void init() throws Throwable {
    for (KernelExtensionFactory kernelExtensionFactory : kernelExtensionFactories) {
        Object kernelExtensionDependencies = getKernelExtensionDependencies(kernelExtensionFactory);
        try {
            Lifecycle dependency = kernelExtensionFactory.newInstance(kernelContext, kernelExtensionDependencies);
            Objects.requireNonNull(dependency, kernelExtensionFactory.toString() + " returned a null " + "KernelExtension");
            life.add(dependencies.satisfyDependency(dependency));
        } catch (UnsatisfiedDependencyException e) {
            unsatisfiedDepencyStrategy.handle(kernelExtensionFactory, e);
        }
    }
    life.init();
}
Also used : UnsatisfiedDependencyException(org.neo4j.kernel.impl.util.UnsatisfiedDependencyException) Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle)

Example 3 with UnsatisfiedDependencyException

use of org.neo4j.kernel.impl.util.UnsatisfiedDependencyException in project neo4j by neo4j.

the class EnterpriseNeoServer method createWebServer.

@Override
protected WebServer createWebServer() {
    Jetty9WebServer webServer = (Jetty9WebServer) super.createWebServer();
    webServer.setJettyCreatedCallback((jetty) -> {
        ThreadPool threadPool = jetty.getThreadPool();
        assert threadPool != null;
        try {
            ServerThreadViewSetter setter = database.getGraph().getDependencyResolver().resolveDependency(ServerThreadViewSetter.class);
            setter.set(new ServerThreadView() {

                @Override
                public int allThreads() {
                    return threadPool.getThreads();
                }

                @Override
                public int idleThreads() {
                    return threadPool.getIdleThreads();
                }
            });
        } catch (UnsatisfiedDependencyException ex) {
        // nevermind, metrics are likely not enabled
        }
    });
    return webServer;
}
Also used : ServerThreadView(org.neo4j.metrics.source.server.ServerThreadView) UnsatisfiedDependencyException(org.neo4j.kernel.impl.util.UnsatisfiedDependencyException) ThreadPool(org.eclipse.jetty.util.thread.ThreadPool) Jetty9WebServer(org.neo4j.server.web.Jetty9WebServer) ServerThreadViewSetter(org.neo4j.metrics.source.server.ServerThreadViewSetter)

Aggregations

UnsatisfiedDependencyException (org.neo4j.kernel.impl.util.UnsatisfiedDependencyException)3 ThreadPool (org.eclipse.jetty.util.thread.ThreadPool)1 BindingNotifier (org.neo4j.cluster.com.BindingNotifier)1 ClusterMemberAvailability (org.neo4j.cluster.member.ClusterMemberAvailability)1 ClusterMemberEvents (org.neo4j.cluster.member.ClusterMemberEvents)1 Lifecycle (org.neo4j.kernel.lifecycle.Lifecycle)1 ServerThreadView (org.neo4j.metrics.source.server.ServerThreadView)1 ServerThreadViewSetter (org.neo4j.metrics.source.server.ServerThreadViewSetter)1 Jetty9WebServer (org.neo4j.server.web.Jetty9WebServer)1