Package reactor.netty
Interface ConnectionObserver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Event listeners for connection lifecycle.
A normal event cycle is as follows :
- onUncaughtException
- onStateChange
- Since:
- 0.8
- Author:
- Stephane Maldini
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA marker interface for various state signals used inonStateChange(Connection, State) -
Method Summary
Modifier and TypeMethodDescriptiondefault ContextConnection listenerContext.static ConnectionObserverReturn a noop connection listener.voidonStateChange(Connection connection, ConnectionObserver.State newState) React on connection state change (e.g.default voidonUncaughtException(Connection connection, Throwable error) React on connection fatal error, will request a disconnecting state change by default.default ConnectionObserverthen(ConnectionObserver other) Chain together anotherConnectionObserver.
-
Method Details
-
emptyListener
Return a noop connection listener.- Returns:
- a noop connection listener
-
currentContext
Connection listenerContext.- Returns:
- current
ContextorContext.empty()
-
onUncaughtException
React on connection fatal error, will request a disconnecting state change by default. It should only catch exceptions that can't be consumed by aNettyInbound.receive()subscriber.- Parameters:
connection- the remote connectionerror- the failing cause
-
onStateChange
React on connection state change (e.g. http request or response).- Parameters:
connection- the connection referencenewState- the new State
-
then
Chain together anotherConnectionObserver.- Parameters:
other- the nextConnectionObserver- Returns:
- a new composite
ConnectionObserver
-