public void stop() throws InterruptedException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
String storageEngine = "mongodb";
GenericServiceModel.Request request = GenericServiceModel.Request.newBuilder()
.setStorageEngine(storageEngine)
.build();
String grpcServerHost = "localhost";
int grpcServerPort = configuration.getServer().getGrpc();
if (grpcServerCommandOptions.port > 0) {
grpcServerPort = grpcServerCommandOptions.port;
}
logger.debug("Stopping gRPC server at '{}:{}'", grpcServerHost, grpcServerPort);
ManagedChannel channel = ManagedChannelBuilder.forAddress(grpcServerHost, grpcServerPort)
.usePlaintext(true)
.build();
AdminServiceGrpc.AdminServiceBlockingStub adminServiceBlockingStub = AdminServiceGrpc.newBlockingStub(channel);
GenericServiceModel.MapResponse stop = adminServiceBlockingStub.stop(request);
Map<String, String> values = stop.getValues();
System.out.println(values);
channel.shutdown().awaitTermination(2, TimeUnit.SECONDS);
}