public void start() throws Exception {
        HealthStatusManager healthStatusManager = new HealthStatusManager();
        ServerCredentials creds;
        if (secure) {
            TlsServerCredentials.Builder channelCredBuilder = TlsServerCredentials.newBuilder();
            channelCredBuilder.keyManager(certChain, privateKey, privateKeyPassword);
            if (trustCertCollection != null && trustCertCollection.exists()) {
                channelCredBuilder.trustManager(trustCertCollection);
                if (clientAuthRequired) {
                    channelCredBuilder.clientAuth(TlsServerCredentials.ClientAuth.REQUIRE);
                }
            }
            creds = channelCredBuilder.build();
        } else {
            creds = InsecureServerCredentials.create();
        }
        if (tikaConfigXml == null) {
            // Create a default tika config
            tikaConfigXml = File.createTempFile("tika-config", ".xml");
            try (FileWriter fw = new FileWriter(tikaConfigXml, StandardCharsets.UTF_8)) {
                TikaConfigSerializer.serialize(new TikaConfig(), TikaConfigSerializer.Mode.STATIC_FULL, fw, StandardCharsets.UTF_8);
            }
        }
        File tikaConfigFile = new File(tikaConfigXml.getAbsolutePath());
        healthStatusManager.setStatus(TikaGrpcServer.class.getSimpleName(), ServingStatus.SERVING);
        server = Grpc
                .newServerBuilderForPort(port, creds)
                .addService(new TikaGrpcServerImpl(tikaConfigFile.getAbsolutePath()))
                .addService(healthStatusManager.getHealthService())
                .addService(ProtoReflectionServiceV1.newInstance())
                .build()
                .start();
        LOGGER.info("Server started, listening on " + port);
        Runtime
                .getRuntime()
                .addShutdownHook(new Thread(() -> {
                    // Use stderr here since the logger may have been reset by its JVM shutdown hook.
                    System.err.println("*** shutting down gRPC server since JVM is shutting down");
                    healthStatusManager.clearStatus(TikaGrpcServer.class.getSimpleName());
                    try {
                        TikaGrpcServer.this.stop();
                    } catch (InterruptedException e) {
                        e.printStackTrace(System.err);
                    }
                    System.err.println("*** server shut down");
                }));
    }
Server that manages startup/shutdown of the GRPC Tika server.
tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServer.java