public final class Server
extends java.lang.Object
implements io.spine.logging.Logging
CommandService
and QueryService
.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.
|
static Server.Builder |
inProcess(java.lang.String serverName)
Initiates creating an in-process server exposed with the given name.
|
int |
port()
Deprecated.
please do not use
|
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.
|
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.
@Deprecated public int port()