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 ofConnectionAcceptor
that 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 Completable
accept(ConnectionContext context)
Evaluate the passedConnectionContext
to accept or reject.Completable
closeAsync()
Used to close/shutdown a resource.Completable
closeAsyncGracefully()
Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync()
, but attempts to cleanup state before abruptly closing.protected ConnectionAcceptor
delegate()
TheConnectionAcceptor
to 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
-ConnectionAcceptor
to delegate all calls to.
-
-
Method Detail
-
accept
public Completable accept(ConnectionContext context)
Description copied from interface:ConnectionAcceptor
Evaluate the passedConnectionContext
to accept or reject. If the returnedCompletable
terminates successfully then the passedConnectionContext
will be accepted, otherwise rejected.- Specified by:
accept
in interfaceConnectionAcceptor
- Parameters:
context
- theConnectionContext
to evaluate.- Returns:
Completable
, which when terminated successfully, the passedConnectionContext
is accepted, otherwise rejected.
-
closeAsync
public Completable closeAsync()
Description copied from interface:AsyncCloseable
Used to close/shutdown a resource.- Specified by:
closeAsync
in interfaceAsyncCloseable
- Specified by:
closeAsync
in interfaceConnectionAcceptor
- Returns:
- A
Completable
that is notified once the close is complete.
-
closeAsyncGracefully
public Completable closeAsyncGracefully()
Description copied from interface:AsyncCloseable
Used 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:
closeAsyncGracefully
in interfaceAsyncCloseable
- Returns:
- A
Completable
that is notified once the close is complete.
-
delegate
protected final ConnectionAcceptor delegate()
TheConnectionAcceptor
to which all calls are delegated to.- Returns:
ConnectionAcceptor
to which all calls are delegated.
-
-