public final class Server
extends java.lang.Object
implements io.spine.logging.Logging
Modifier and Type | Class and Description |
---|---|
static class |
Server.Builder
The builder for the server.
|
Modifier and Type | Method and Description |
---|---|
static Server.Builder |
atPort(int port)
Initiates creating a server exposed at the passed port.
|
void |
awaitTermination()
Waits for the server to become terminated.
|
CommandService |
commandService()
Obtains the
CommandService exposed by this server. |
static Server.Builder |
inProcess(java.lang.String serverName)
Initiates creating an in-process server exposed with the given name.
|
static Server.Builder |
newBuilder()
Deprecated.
please use
Server.atPort(int) or Server.inProcess(String) |
int |
port()
Deprecated.
please do not use
|
QueryService |
queryService()
Obtains the
QueryService exposed by this server. |
void |
shutdown()
Initiates an orderly shutdown in which existing calls continue but new calls are rejected.
|
void |
shutdownAndWait()
Initiates a forceful shutdown in which preexisting and new calls are rejected.
|
void |
start()
Starts the server.
|
SubscriptionService |
subscriptionService()
Obtains the
SubscriptionService exposed by this server. |
@Deprecated public static Server.Builder newBuilder()
Server.atPort(int)
or Server.inProcess(String)
public static Server.Builder atPort(int port)
public static Server.Builder inProcess(java.lang.String serverName)
The server is full-featured, high performance, and is useful in testing.
public void start() throws java.io.IOException
java.io.IOException
- if the service could not be startedpublic void awaitTermination()
public void shutdown()
public void shutdownAndWait()
The method returns when the server becomes terminated.
The most common usage scenario for this method is clean-up in unit tests
(e.g. @AfterEach
in JUnit5) that involve client-server communications.
public QueryService queryService()
QueryService
exposed by this server.public SubscriptionService subscriptionService()
SubscriptionService
exposed by this server.public CommandService commandService()
CommandService
exposed by this server.@Deprecated public int port()