use of org.neo4j.metrics.source.server.ServerThreadViewSetter 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;
}
Aggregations