-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enrich ConnectionPoolListener
interface to listen to more connection events
#4649
Labels
Comments
I propose new APIs for the new connection events. public interface ConnectionPoolListener {
// Since a connection becomes active immediately after it is open,
// this method can be replaced with `connectionActive()`.
@Deprecated
void connectionOpen(SessionProtocol protocol,
InetSocketAddress remoteAddr,
InetSocketAddress localAddr,
AttributeMap attrs) throws Exception;
// This method will be invoked when either 1) a connection is established or
// 2) an idle connection becomes active.
default void connectionActive(SessionProtocol protocol,
InetSocketAddress remoteAddr,
InetSocketAddress localAddr,
AttributeMap attrs, boolean isNew) throws Exception {
if (isNew) {
connectionOpen(protocol, remoteAddr, localAddr, attrs);
}
}
// This method will be invoked when `KeepAliveHandler` detects
// that the connection's inactivity exceeds the idle timeout.
default void connectionIdle(SessionProtocol protocol,
InetSocketAddress remoteAddr,
InetSocketAddress localAddr,
AttributeMap attrs) throws Exception {}
default void connectionFailed(SessionProtocol protocol,
InetSocketAddress remoteAddr,
InetSocketAddress localAddr,
Throwable cause) throws Exception {}
void connectionClosed(SessionProtocol protocol,
InetSocketAddress remoteAddr,
InetSocketAddress localAddr,
AttributeMap attrs) throws Exception;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original question/context:
https://line-armeria.slack.com/archives/C1NGPBUH2/p1675388028842779
The
ConnectionPoolListener
(set here) provides APIs to listen 2 types of connection events:Consider adding APIs to the
ConnectionPoolListener
interface to listen to more types of connection events such as:pending
. // still trying to establish a connection.active
. // sending a request, waiting for response, or receiving a response.idle
. // after the last response has been received and before the next request is sent.IMO
Connection failed
listener API is useful and feasible to add. Other connection state transition APIs ( above 2, 3, and 4) may not be very useful or may be very complex/challenging to implement. Let me know what you think @trustin . Thanks!The text was updated successfully, but these errors were encountered: