public class DelegatingConnectionAcceptor extends java.lang.Object implements ConnectionAcceptor
ConnectionAcceptor
that delegates all methods to another ConnectionAcceptor
.ACCEPT_ALL
Constructor and Description |
---|
DelegatingConnectionAcceptor(ConnectionAcceptor delegate)
New instance.
|
Modifier and Type | Method and Description |
---|---|
Completable |
accept(ConnectionContext context)
Evaluate the passed
ConnectionContext to accept or reject. |
Completable |
closeAsync()
Used to close/shutdown a resource.
|
Completable |
closeAsyncGracefully()
Used to close/shutdown a resource, similar to
AsyncCloseable.closeAsync() , but attempts to cleanup state before
abruptly closing. |
protected ConnectionAcceptor |
delegate()
The
ConnectionAcceptor to which all calls are delegated to. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append
public DelegatingConnectionAcceptor(ConnectionAcceptor delegate)
delegate
- ConnectionAcceptor
to delegate all calls to.public Completable accept(ConnectionContext context)
ConnectionAcceptor
ConnectionContext
to accept or reject. If the returned Completable
terminates
successfully then the passed ConnectionContext
will be accepted, otherwise rejected.accept
in interface ConnectionAcceptor
context
- the ConnectionContext
to evaluate.Completable
, which when terminated successfully, the passed ConnectionContext
is accepted, otherwise rejected.public Completable closeAsync()
AsyncCloseable
closeAsync
in interface AsyncCloseable
closeAsync
in interface ConnectionAcceptor
CompletableSource
that is notified once the close is complete.public Completable closeAsyncGracefully()
AsyncCloseable
AsyncCloseable.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 to AsyncCloseable.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()
.
closeAsyncGracefully
in interface AsyncCloseable
Completable
that is notified once the close is complete.protected final ConnectionAcceptor delegate()
ConnectionAcceptor
to which all calls are delegated to.ConnectionAcceptor
to which all calls are delegated.