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, short 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 protected booleancanReleaseReferencesImmediately()Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.intgetBoundPort()CompletableFuture<Void>getShutdownCompleteFuture()protected voidreleaseNativeHandle()Required override method that must begin the release process of the acquired native handle-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Constructor Detail
-
ServerListener
public ServerListener(String hostName, short 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.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
-
releaseNativeHandle
protected void releaseNativeHandle()
Description copied from class:CrtResourceRequired override method that must begin the release process of the acquired native handle- Specified by:
releaseNativeHandlein classCrtResource
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Description copied from class:CrtResourceOverride that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources with asynchronous shutdown processes should override this with false, and establish a callback from native code that invokes releaseReferences() when the asynchronous shutdown process has completed. See HttpClientConnectionManager for an example.- Specified by:
canReleaseReferencesImmediatelyin classCrtResource- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
getBoundPort
public int getBoundPort()
- Returns:
- the port which the listener socket is bound to.
-
getShutdownCompleteFuture
public CompletableFuture<Void> getShutdownCompleteFuture()
- Returns:
- future to synchronize shutdown completion of this object.
-
-