Class InProcessServer
java.lang.Object
io.grpc.inprocess.InProcessServer
- All Implemented Interfaces:
InternalServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddressprivate ServerListenerprivate final intprivate static final ConcurrentMap<String, InProcessServer> private ScheduledExecutorServiceOnly used to make sure the scheduler has at least one reference.private final ObjectPool<ScheduledExecutorService> Defaults to be a SharedResourcePool.private booleanprivate final List<ServerStreamTracer.Factory> -
Constructor Summary
ConstructorsConstructorDescriptionInProcessServer(InProcessServerBuilder builder, List<? extends ServerStreamTracer.Factory> streamTracerFactories) -
Method Summary
Modifier and TypeMethodDescription(package private) static InProcessServerfindServer(SocketAddress addr) Returns the first listening socket address.List<? extends SocketAddress> Returns a list of listening socket addresses.Returns the first listen socket stats of this server.Returns a list of listen socket stats of this server.(package private) int(package private) ObjectPool<ScheduledExecutorService> (package private) List<ServerStreamTracer.Factory> (package private) ServerTransportListenerregister(InProcessTransport transport) private voidvoidshutdown()Initiates an orderly shutdown of the server.voidstart(ServerListener serverListener) Starts transport.toString()private void
-
Field Details
-
registry
-
listenAddress
-
maxInboundMetadataSize
private final int maxInboundMetadataSize -
streamTracerFactories
-
listener
-
shutdown
private boolean shutdown -
schedulerPool
Defaults to be a SharedResourcePool. -
scheduler
Only used to make sure the scheduler has at least one reference. Since child transports can outlive this server, they must get their own reference.
-
-
Constructor Details
-
InProcessServer
InProcessServer(InProcessServerBuilder builder, List<? extends ServerStreamTracer.Factory> streamTracerFactories)
-
-
Method Details
-
findServer
-
start
Description copied from interface:InternalServerStarts transport. Implementations must not calllisteneruntil afterstart()returns. The method only returns after it has done the equivalent of bind()ing, so it will be able to service any connections created after returning.- Specified by:
startin interfaceInternalServer- Parameters:
serverListener- non-nulllistener of server events- Throws:
IOException- if unable to bind
-
registerInstance
- Throws:
IOException
-
getListenSocketAddress
Description copied from interface:InternalServerReturns the first listening socket address. May change afterInternalServer.start(ServerListener)is called.- Specified by:
getListenSocketAddressin interfaceInternalServer
-
getListenSocketAddresses
Description copied from interface:InternalServerReturns a list of listening socket addresses. May change afterInternalServer.start(ServerListener)is called.- Specified by:
getListenSocketAddressesin interfaceInternalServer
-
getListenSocketStats
Description copied from interface:InternalServerReturns the first listen socket stats of this server. May returnnull.- Specified by:
getListenSocketStatsin interfaceInternalServer
-
getListenSocketStatsList
Description copied from interface:InternalServerReturns a list of listen socket stats of this server. May returnnull.- Specified by:
getListenSocketStatsListin interfaceInternalServer
-
shutdown
public void shutdown()Description copied from interface:InternalServerInitiates an orderly shutdown of the server. Existing transports continue, but new transports will not be created (onceServerListener.serverShutdown()callback is called). This method may only be called once. Blocks until the listening socket(s) have been closed. If interrupted, this method will not wait for the close to complete, but it will happen asynchronously.- Specified by:
shutdownin interfaceInternalServer
-
unregisterInstance
private void unregisterInstance() -
toString
-
register
-
getScheduledExecutorServicePool
ObjectPool<ScheduledExecutorService> getScheduledExecutorServicePool() -
getMaxInboundMetadataSize
int getMaxInboundMetadataSize() -
getStreamTracerFactories
List<ServerStreamTracer.Factory> getStreamTracerFactories()
-