GrpcContainer

public final class GrpcContainer

Wrapping container for gRPC server.

Maintains and deploys several of gRPC services within a single server.

Uses ServerServiceDefinitions of each service.

Types

Link copied to clipboard
public final class Builder extends ConnectionBuilder
The builder for GrpcContainer allows to define a port and services exposed by the container.
Link copied to clipboard
public interface ConfigureServer implements Function<T, R>
Allows to configure the gRPC's Server instance, on top of which this GrpcContainer will operate.

Functions

Link copied to clipboard
public void addShutdownHook()
Makes the JVM shut down the service when it is shutting down itself.
Link copied to clipboard
public static GrpcContainer.Builder atPort(int port)
Initiates creating a container exposed at the given port.
Link copied to clipboard
public void awaitTermination()
Waits for the service to become terminated.
Link copied to clipboard
public void injectServer(Server server)
Injects a server to this container.
Link copied to clipboard
public static GrpcContainer.Builder inProcess(String serverName)
Initiates creating an in-process container exposed with the given server name.
Link copied to clipboard
public boolean isLive(BindableService service)
Check if the given gRPC service has actually been deployed and is available for interaction within this container.
Link copied to clipboard
public boolean isScheduledForDeployment(BindableService service)
Check if the given gRPC service is scheduled for the deployment in this container.
Link copied to clipboard
public boolean isShutdown()
Returns true if the server is shut down or was not started at all, false otherwise.
Link copied to clipboard
Creates a new builder for the container.
Link copied to clipboard
public Optional<Integer> port()
Obtains the port at which the container is exposed, or empty Optional if this is an in-process container.
Link copied to clipboard
Obtains the name of the in-process server, or empty Optinal if the container is exposed at a port.
Link copied to clipboard
public void shutdown()
Initiates an orderly shutdown in which existing calls continue but new calls are rejected.
Link copied to clipboard
public void shutdownNowAndWait()
Initiates a forceful shutdown in which preexisting and new calls are rejected.
Link copied to clipboard
public void start()
Starts the service.
public void start(Executor executor)
Starts the service on top of the given Executor.