Class ConnectionPoolClearedEvent

java.lang.Object
com.mongodb.event.ConnectionPoolClearedEvent

public final class ConnectionPoolClearedEvent extends Object
An event signifying when a connection pool is cleared and paused.
Since:
4.0
  • Constructor Details

    • ConnectionPoolClearedEvent

      public ConnectionPoolClearedEvent(ServerId serverId)
      Constructs a new instance of the event.
      Parameters:
      serverId - the server id
    • ConnectionPoolClearedEvent

      public ConnectionPoolClearedEvent(ServerId serverId, @Nullable ObjectId serviceId)
      Constructs a new instance of the event.
      Parameters:
      serverId - the server id
      serviceId - the service id, which may be null
      Since:
      4.3
  • Method Details

    • getServerId

      public ServerId getServerId()
      Gets the server id
      Returns:
      the server id
    • getServiceId

      @Nullable public ObjectId getServiceId()
      Gets the service id.

      When connected to a load balancer, in some cases the driver clears only a subset of connections in the pool, based on the service id reported on the connection on which the error occurred.

      Returns:
      the service id, which may be null
      Since:
      4.3
    • toString

      public String toString()
      Overrides:
      toString in class Object