Interface ConnectionPoolListener

All Superinterfaces:
Unwrappable
All Known Implementing Classes:
ConnectionPoolListenerAdapter, ConnectionPoolListenerWrapper

public interface ConnectionPoolListener extends Unwrappable
Listens to the client connection pool events.
  • Method Details

    • noop

      static ConnectionPoolListener noop()
      Returns an instance that does nothing.
    • logging

      static ConnectionPoolListener logging()
      Returns a ConnectionPoolListener that logs the connection pool events.
    • logging

      static ConnectionPoolListener logging(Ticker ticker)
      Returns a ConnectionPoolListener that logs the connection pool events with an alternative Ticker.
    • metricCollecting

      @UnstableApi static ConnectionPoolListener metricCollecting(io.micrometer.core.instrument.MeterRegistry registry)
      Returns a new ConnectionPoolListener that collects metrics into the specified MeterRegistry. The returned listener will generate the following metrics:
      metrics that will be generated by this class
      metric name description
      armeria.client.connections#count{state="opened"} The number of opened connection.
      armeria.client.connections#count{state="closed"} The number of closed connections.
    • metricCollecting

      @UnstableApi static ConnectionPoolListener metricCollecting(io.micrometer.core.instrument.MeterRegistry registry, MeterIdPrefix meterIdPrefix)
      Returns a new ConnectionPoolListener that collects metrics into the specified MeterRegistry using the MeterIdPrefix. The returned listener will generate the following metrics:
      metrics that will be generated by this class
      metric name description
      <name>#count{state="opened"} The number of opened connection.
      <name>#count{state="closed"} The number of closed connections.
    • connectionOpen

      void connectionOpen(SessionProtocol protocol, InetSocketAddress remoteAddr, InetSocketAddress localAddr, io.netty.util.AttributeMap attrs) throws Exception
      Invoked when a new connection is open and ready to send a request.
      Throws:
      Exception
    • connectionClosed

      void connectionClosed(SessionProtocol protocol, InetSocketAddress remoteAddr, InetSocketAddress localAddr, io.netty.util.AttributeMap attrs) throws Exception
      Invoked when a connection in the connection pool has been closed.
      Throws:
      Exception
    • unwrap

      default ConnectionPoolListener unwrap()
      Description copied from interface: Unwrappable
      Unwraps this object and returns the object being decorated. If this Unwrappable is the innermost object, this method returns itself. For example:
      
       class Foo implements Unwrappable {}
      
       class Bar<T extends Unwrappable> extends AbstractUnwrappable<T> {
           Bar(T delegate) {
               super(delegate);
           }
       }
      
       class Qux<T extends Unwrappable> extends AbstractUnwrappable<T> {
           Qux(T delegate) {
               super(delegate);
           }
       }
      
       Foo foo = new Foo();
       assert foo.unwrap() == foo;
      
       Bar<Foo> bar = new Bar<>(foo);
       assert bar.unwrap() == foo;
      
       Qux<Bar<Foo>> qux = new Qux<>(bar);
       assert qux.unwrap() == bar;
       assert qux.unwrap().unwrap() == foo;
       
      Specified by:
      unwrap in interface Unwrappable