Top Description Inners Methods
reactor.netty

public Interface ConnectionObserver

Known Direct Implementers
reactor.netty.ReactorNetty.CompositeConnectionObserver, reactor.netty.resources.DefaultPooledConnectionProvider.DisposableAcquire, reactor.netty.resources.DefaultPooledConnectionProvider.PendingConnectionObserver, reactor.netty.resources.DefaultPooledConnectionProvider.PooledConnection, reactor.netty.resources.NewConnectionProvider.NewConnectionObserver, reactor.netty.transport.ClientTransportConfig.ClientTransportDoOn, reactor.netty.transport.ServerTransport.ChildObserver, reactor.netty.transport.ServerTransportConfig.ServerTransportDoOn, reactor.netty.transport.ServerTransportConfig.ServerTransportDoOnConnection, reactor.netty.udp.UdpServerConfig.UdpServerDoOn
Annotations
@FunctionalInterface
Imports
reactor.util.context.Context

Event listeners for connection lifecycle. A normal event cycle is as follows :
  1. onUncaughtException
  2. onStateChange
Author
Stephane Maldini
Since
0.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ConnectionObserver.State

A marker interface for various state signals used in onStateChange(Connection, State)

Specific protocol might implement more state type for instance request/response lifecycle.

Method Summary

Modifier and TypeMethod and Description
public default Context

Returns:

current Context or Context#empty()
currentContext
()

Connection listener Context.

public static ConnectionObserver

Returns:

a noop connection listener
emptyListener
()

Return a noop connection listener.

public void
onStateChange(Connection
the connection reference
connection
,
ConnectionObserver.State
the new State
newState
)

React on connection state change (e.g. http request or response).

public default void
onUncaughtException(Connection
the remote connection
connection
,
Throwable
the failing cause
error
)

React on connection fatal error, will request a disconnecting state change by default.

public default ConnectionObserver

Returns:

a new composite ConnectionObserver
then
(ConnectionObserver other)

Chain together another ConnectionObserver.

Method Detail

currentContextback to summary
public default Context currentContext()

Connection listener Context.

Returns:Context

current Context or Context#empty()

emptyListenerback to summary
public static ConnectionObserver emptyListener()

Return a noop connection listener.

Returns:ConnectionObserver

a noop connection listener

onStateChangeback to summary
public void onStateChange(Connection connection, ConnectionObserver.State newState)

React on connection state change (e.g. http request or response).

Parameters
connection:Connection

the connection reference

newState:ConnectionObserver.State

the new State

onUncaughtExceptionback to summary
public default void onUncaughtException(Connection connection, Throwable error)

React on connection fatal error, will request a disconnecting state change by default. It should only catch exceptions that can't be consumed by a NettyInbound#receive subscriber.

Parameters
connection:Connection

the remote connection

error:Throwable

the failing cause

thenback to summary
public default ConnectionObserver then(ConnectionObserver other)

Chain together another ConnectionObserver.

Parameters
other:ConnectionObserver

the next ConnectionObserver

Returns:ConnectionObserver

a new composite ConnectionObserver

reactor.netty back to summary

public Interface ConnectionObserver.State


A marker interface for various state signals used in onStateChange(Connection, State)

Specific protocol might implement more state type for instance request/response lifecycle.

Field Summary

Modifier and TypeField and Description
public static final ConnectionObserver.State
ACQUIRED

Propagated when a connection has been reused / acquired (keep-alive or pooling)

public static final ConnectionObserver.State
CONFIGURED

Propagated when a connection is bound to a channelOperation and ready for user interaction

public static final ConnectionObserver.State
CONNECTED

Propagated when a connection has been established and is available

public static final ConnectionObserver.State
DISCONNECTING

Propagated when a connection is being fully closed

public static final ConnectionObserver.State
RELEASED

Propagated when a connection has been released but not fully closed (keep-alive or pooling)

Field Detail

ACQUIREDback to summary
public static final ConnectionObserver.State ACQUIRED

Propagated when a connection has been reused / acquired (keep-alive or pooling)

CONFIGUREDback to summary
public static final ConnectionObserver.State CONFIGURED

Propagated when a connection is bound to a channelOperation and ready for user interaction

CONNECTEDback to summary
public static final ConnectionObserver.State CONNECTED

Propagated when a connection has been established and is available

DISCONNECTINGback to summary
public static final ConnectionObserver.State DISCONNECTING

Propagated when a connection is being fully closed

RELEASEDback to summary
public static final ConnectionObserver.State RELEASED

Propagated when a connection has been released but not fully closed (keep-alive or pooling)