Package com.mongodb.event
Class ServerHeartbeatSucceededEvent
- java.lang.Object
-
- com.mongodb.event.ServerHeartbeatSucceededEvent
-
public final class ServerHeartbeatSucceededEvent extends Object
An event for successful completion of a server heartbeat.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description ServerHeartbeatSucceededEvent(ConnectionId connectionId, BsonDocument reply, long elapsedTimeNanos)
Deprecated.ServerHeartbeatSucceededEvent(ConnectionId connectionId, BsonDocument reply, long elapsedTimeNanos, boolean awaited)
Construct an instance.
-
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.BsonDocument
getReply()
Gets the reply to the isMaster command executed for this heartbeat.boolean
isAwaited()
Gets whether the heartbeat was awaited.String
toString()
-
-
-
Constructor Detail
-
ServerHeartbeatSucceededEvent
@Deprecated public ServerHeartbeatSucceededEvent(ConnectionId connectionId, BsonDocument reply, long elapsedTimeNanos)
Deprecated.Construct an instance.- Parameters:
connectionId
- the non-null connectionIdreply
- the non-null reply to an isMaster commandelapsedTimeNanos
- the non-negative elapsed time in nanoseconds
-
ServerHeartbeatSucceededEvent
public ServerHeartbeatSucceededEvent(ConnectionId connectionId, BsonDocument reply, long elapsedTimeNanos, boolean awaited)
Construct an instance.- Parameters:
connectionId
- the non-null connectionIdreply
- the non-null reply to an isMaster commandelapsedTimeNanos
- the non-negative elapsed time in nanosecondsawaited
- true if the response was awaited- Since:
- 4.1
-
-
Method Detail
-
getConnectionId
public ConnectionId getConnectionId()
Gets the connectionId.- Returns:
- the connectionId
-
getReply
public BsonDocument getReply()
Gets the reply to the isMaster command executed for this heartbeat.- Returns:
- the reply
-
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
-
-