in callouts/java/service-callout/src/main/java/service/ServiceCallout.java [212:257]
public void start() throws IOException {
ExternalProcessorImpl processor = new ExternalProcessorImpl();
if (cert != null && certKey != null) {
logger.info("Secure server starting...");
server = NettyServerBuilder.forPort(port)
.sslContext(createSslContext(cert, certKey))
.addService(processor)
.executor(Executors.newFixedThreadPool(serverThreadCount)) // Configurable thread pool
.build()
.start();
logger.info("Secure Server started, listening on " + port);
}
if (enablePlainTextPort) {
logger.info("Plaintext server starting...");
plaintextServer = ServerBuilder.forPort(plaintextPort)
.addService(processor)
.executor(Executors.newFixedThreadPool(serverThreadCount)) // Configurable thread pool
.build()
.start();
logger.info("Plaintext Server started, listening on " + plaintextPort);
}
// Start Health Check Server if enabled
if (!combinedHealthCheck) {
healthCheckServer.start();
logger.info("Health Check Server started, listening on " + healthCheckIp + ":" + healthCheckPort + " at path " + healthCheckPath);
}
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
logger.info("*** shutting down gRPC server since JVM is shutting down");
try {
ServiceCallout.this.stop();
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
logger.info("*** server shut down");
}));
}