Package io.servicetalk.transport.api
Class DelegatingConnectionAcceptor
- java.lang.Object
-
- io.servicetalk.transport.api.DelegatingConnectionAcceptor
-
- All Implemented Interfaces:
AsyncCloseable,ConnectionAcceptor
public class DelegatingConnectionAcceptor extends java.lang.Object implements ConnectionAcceptor
An implementation ofConnectionAcceptorthat delegates all methods to anotherConnectionAcceptor.
-
-
Field Summary
-
Fields inherited from interface io.servicetalk.transport.api.ConnectionAcceptor
ACCEPT_ALL
-
-
Constructor Summary
Constructors Constructor Description DelegatingConnectionAcceptor(ConnectionAcceptor delegate)New instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Completableaccept(ConnectionContext context)Evaluate the passedConnectionContextto accept or reject.CompletablecloseAsync()Used to close/shutdown a resource.CompletablecloseAsyncGracefully()Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing.protected ConnectionAcceptordelegate()TheConnectionAcceptorto which all calls are delegated to.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.servicetalk.transport.api.ConnectionAcceptor
append
-
-
-
-
Constructor Detail
-
DelegatingConnectionAcceptor
public DelegatingConnectionAcceptor(ConnectionAcceptor delegate)
New instance.- Parameters:
delegate-ConnectionAcceptorto delegate all calls to.
-
-
Method Detail
-
accept
public Completable accept(ConnectionContext context)
Description copied from interface:ConnectionAcceptorEvaluate the passedConnectionContextto accept or reject. If the returnedCompletableterminates successfully then the passedConnectionContextwill be accepted, otherwise rejected.- Specified by:
acceptin interfaceConnectionAcceptor- Parameters:
context- theConnectionContextto evaluate.- Returns:
Completable, which when terminated successfully, the passedConnectionContextis accepted, otherwise rejected.
-
closeAsync
public Completable closeAsync()
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource.- Specified by:
closeAsyncin interfaceAsyncCloseable- Specified by:
closeAsyncin interfaceConnectionAcceptor- Returns:
- A
Completablethat is notified once the close is complete.
-
closeAsyncGracefully
public Completable closeAsyncGracefully()
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in flight work. This method is implemented on a "best effort" basis and may be equivalent toAsyncCloseable.closeAsync().Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a timeout and force a call to
AsyncCloseable.closeAsync().- Specified by:
closeAsyncGracefullyin interfaceAsyncCloseable- Returns:
- A
Completablethat is notified once the close is complete.
-
delegate
protected final ConnectionAcceptor delegate()
TheConnectionAcceptorto which all calls are delegated to.- Returns:
ConnectionAcceptorto which all calls are delegated.
-
-