Class ServerListener
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.eventstream.ServerListener
-
- All Implemented Interfaces:
AutoCloseable
public class ServerListener extends CrtResource
Event-stream-rpc server listener. Once it begins listening, it will provide new connections as they arrive.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Constructor Description ServerListener(String hostName, int port, SocketOptions socketOptions, ServerTlsContext tlsContext, ServerBootstrap serverBootstrap, ServerListenerHandler handler)
Instantiates a server listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBoundPort()
CompletableFuture<Void>
getShutdownCompleteFuture()
-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, logNativeResources, removeReferenceTo, setDescription, waitForNoResources
-
-
-
-
Constructor Detail
-
ServerListener
public ServerListener(String hostName, int port, SocketOptions socketOptions, ServerTlsContext tlsContext, ServerBootstrap serverBootstrap, ServerListenerHandler handler)
Instantiates a server listener. Once this function completes, the server is configured and listening for new connections.- Parameters:
hostName
- name of the host to listen on. Can be a dns name, ip address, or unix domain socket (or named pipe on windows) name.port
- port to listen on. Ignored for local domain sockets. For 32bit values exceeding Integer.MAX_VALUE use two's complement (i.e. -1 == 0xFFFFFFFF).socketOptions
- socket options to apply to the listening socket.tlsContext
- optional tls context to apply to the connection if you want to use TLS.serverBootstrap
- bootstrap object for handling connections.handler
- functor interface for handling incoming connections and connection closures.
-
-
Method Detail
-
getBoundPort
public int getBoundPort()
- Returns:
- the port which the listener socket is bound to. Note that two's complement is used for 32bit values exceeding Integer.MAX_VALUE (i.e. -1 == 0xFFFFFFFF).
-
getShutdownCompleteFuture
public CompletableFuture<Void> getShutdownCompleteFuture()
- Returns:
- future to synchronize shutdown completion of this object.
-
-