public final class ServerImpl extends Server implements InternalInstrumented<InternalChannelz.ServerStats>
Server
, for creation by transports.
Expected usage (by a theoretical TCP transport):
public class TcpTransportServerFactory {
public static Server newServer(Executor executor, HandlerRegistry registry,
String configuration) {
return new ServerImpl(executor, registry, new TcpTransportServer(configuration));
}
}
Starting the server starts the underlying transport for servicing requests. Stopping the server stops servicing new requests and waits for all connections to terminate.
Modifier and Type | Method and Description |
---|---|
void |
awaitTermination() |
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
List<ServerServiceDefinition> |
getImmutableServices() |
List<SocketAddress> |
getListenSockets() |
InternalLogId |
getLogId() |
List<ServerServiceDefinition> |
getMutableServices() |
int |
getPort() |
List<ServerServiceDefinition> |
getServices() |
com.google.common.util.concurrent.ListenableFuture<InternalChannelz.ServerStats> |
getStats() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ServerImpl |
shutdown()
Initiates an orderly shutdown in which preexisting calls continue but new calls are rejected.
|
ServerImpl |
shutdownNow() |
ServerImpl |
start()
Bind and start the server.
|
String |
toString() |
public ServerImpl start() throws IOException
start
in class Server
this
objectIllegalStateException
- if already startedIOException
- if unable to bindpublic List<SocketAddress> getListenSockets()
getListenSockets
in class Server
public List<ServerServiceDefinition> getServices()
getServices
in class Server
public List<ServerServiceDefinition> getImmutableServices()
getImmutableServices
in class Server
public List<ServerServiceDefinition> getMutableServices()
getMutableServices
in class Server
public ServerImpl shutdown()
public ServerImpl shutdownNow()
shutdownNow
in class Server
public boolean isShutdown()
isShutdown
in class Server
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in class Server
InterruptedException
public void awaitTermination() throws InterruptedException
awaitTermination
in class Server
InterruptedException
public boolean isTerminated()
isTerminated
in class Server
public InternalLogId getLogId()
getLogId
in interface InternalWithLogId
public com.google.common.util.concurrent.ListenableFuture<InternalChannelz.ServerStats> getStats()
getStats
in interface InternalInstrumented<InternalChannelz.ServerStats>
Copyright © 2019. All rights reserved.