Class ConnectionClosedEvent

java.lang.Object
com.mongodb.event.ConnectionClosedEvent

public final class ConnectionClosedEvent extends Object
An event for when a connection pool closes a connection. Such a connection stops being counted towards ConnectionPoolSettings.getMaxSize().
Since:
4.0
  • Constructor Details

    • ConnectionClosedEvent

      public ConnectionClosedEvent(ConnectionId connectionId, ConnectionClosedEvent.Reason reason)
      Construct an instance
      Parameters:
      connectionId - the connection id
      reason - the reason the connection was closed
  • Method Details

    • getConnectionId

      public ConnectionId getConnectionId()
      Gets the connection id
      Returns:
      the connection id
    • getReason

      public ConnectionClosedEvent.Reason getReason()
      Get the reason the connection was removed.
      Returns:
      the reason
    • toString

      public String toString()
      Overrides:
      toString in class Object