Package com.mongodb.event
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.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConnectionClosedEvent.Reason
An enumeration of the reasons a connection could be closed
-
Constructor Summary
Constructors Constructor Description ConnectionClosedEvent(ConnectionId connectionId, ConnectionClosedEvent.Reason reason)
Construct an instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionId
getConnectionId()
Gets the connection idConnectionClosedEvent.Reason
getReason()
Get the reason the connection was removed.String
toString()
-
-
-
Constructor Detail
-
ConnectionClosedEvent
public ConnectionClosedEvent(ConnectionId connectionId, ConnectionClosedEvent.Reason reason)
Construct an instance- Parameters:
connectionId
- the connection idreason
- the reason the connection was closed
-
-
Method Detail
-
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
-
-