@ThreadSafe public abstract class Server extends Object
Constructor and Description |
---|
Server() |
Modifier and Type | Method and Description |
---|---|
abstract void |
awaitTermination()
Waits for the server to become terminated.
|
abstract boolean |
awaitTermination(long timeout,
TimeUnit unit)
Waits for the server to become terminated, giving up if the timeout is reached.
|
int |
getPort()
Returns the port number the server is listening on.
|
abstract boolean |
isShutdown()
Returns whether the server is shutdown.
|
abstract boolean |
isTerminated()
Returns whether the server is terminated.
|
abstract Server |
shutdown()
Initiates an orderly shutdown in which preexisting calls continue but new calls are rejected.
|
abstract Server |
shutdownNow()
Initiates a forceful shutdown in which preexisting and new calls are rejected.
|
abstract Server |
start()
Bind and start the server.
|
public abstract Server start() throws IOException
this
objectIllegalStateException
- if already startedIOException
- if unable to bind@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1780") public int getPort()
IllegalStateException
- if the server has not yet been started.public abstract Server shutdown()
public abstract Server shutdownNow()
isTerminated()
will likely
return false
immediately after this method returns.public abstract boolean isShutdown()
shutdown()
,
isTerminated()
public abstract boolean isTerminated()
isShutdown()
public abstract boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
isTerminated()
.InterruptedException
public abstract void awaitTermination() throws InterruptedException
InterruptedException