Package com.mongodb.event
Class ServerHeartbeatFailedEvent
- java.lang.Object
-
- com.mongodb.event.ServerHeartbeatFailedEvent
-
public final class ServerHeartbeatFailedEvent extends Object
An event for server heartbeat failures.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description ServerHeartbeatFailedEvent(ConnectionId connectionId, long elapsedTimeNanos, boolean awaited, Throwable throwable)
Construct an instance.ServerHeartbeatFailedEvent(ConnectionId connectionId, long elapsedTimeNanos, Throwable throwable)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionId
getConnectionId()
Gets the connectionId.long
getElapsedTime(TimeUnit timeUnit)
Gets the elapsed time in the given time unit.Throwable
getThrowable()
Gets the exceptions that caused the failureboolean
isAwaited()
Gets whether the heartbeat was awaited.String
toString()
-
-
-
Constructor Detail
-
ServerHeartbeatFailedEvent
@Deprecated public ServerHeartbeatFailedEvent(ConnectionId connectionId, long elapsedTimeNanos, Throwable throwable)
Deprecated.Construct an instance.- Parameters:
connectionId
- the non-null connectionIdelapsedTimeNanos
- the non-negative elapsed time in nanosecondsthrowable
- the non-null exception that caused the failure
-
ServerHeartbeatFailedEvent
public ServerHeartbeatFailedEvent(ConnectionId connectionId, long elapsedTimeNanos, boolean awaited, Throwable throwable)
Construct an instance.- Parameters:
connectionId
- the non-null connectionIdelapsedTimeNanos
- the non-negative elapsed time in nanosecondsawaited
- true if the response was awaitedthrowable
- the non-null exception that caused the failure- Since:
- 4.1
-
-
Method Detail
-
getConnectionId
public ConnectionId getConnectionId()
Gets the connectionId.- Returns:
- the connectionId
-
getElapsedTime
public long getElapsedTime(TimeUnit timeUnit)
Gets the elapsed time in the given time unit.- Parameters:
timeUnit
- the non-null timeUnit- Returns:
- the elapsed time in the given time unit
-
isAwaited
public boolean isAwaited()
Gets whether the heartbeat was awaited. If true, thengetElapsedTime(TimeUnit)
reflects the sum of the round trip time to the server and the time that the server waited before sending a response.- Returns:
- whether the response was awaited
- Since:
- 4.1
- Since server release
- 4.4
-
getThrowable
public Throwable getThrowable()
Gets the exceptions that caused the failure- Returns:
- the exception
-
-