use of org.sonarlint.daemon.interceptors.ExceptionInterceptor in project sonarlint-core by SonarSource.
the class Daemon method start.
public void start(int port, Path sonarlintHome) {
try {
LOGGER.info("Starting server on port {}", port);
ServerInterceptor interceptor = new ExceptionInterceptor();
server = NettyServerBuilder.forAddress(new InetSocketAddress("localhost", port)).addService(ServerInterceptors.intercept(new ConnectedSonarLintImpl(this), interceptor)).addService(ServerInterceptors.intercept(new StandaloneSonarLintImpl(this, Utils.getAnalyzers(sonarlintHome)), interceptor)).build().start();
LOGGER.info("Server started, listening on {}", port);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("JVM is shutting down");
if (!server.isShutdown()) {
Daemon.this.stop();
}
}
});
server.awaitTermination();
} catch (Exception e) {
// grpc threads are daemon, so should not hang process
LOGGER.error("Error running daemon", e);
}
}
Aggregations