Package com.mongodb.event
Class CommandSucceededEvent
java.lang.Object
com.mongodb.event.CommandEvent
com.mongodb.event.CommandSucceededEvent
An event representing the completion of a MongoDB database command.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCommandSucceededEvent
(int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) Deprecated.CommandSucceededEvent
(RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) Deprecated.CommandSucceededEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument response, long elapsedTimeNanos) Construct an instance.CommandSucceededEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) -
Method Summary
Modifier and TypeMethodDescriptionlong
getElapsedTime
(TimeUnit timeUnit) Gets the elapsed time in the given unit of time.Gets the response document.Methods inherited from class com.mongodb.event.CommandEvent
getCommandName, getConnectionDescription, getDatabaseName, getOperationId, getRequestContext, getRequestId
-
Constructor Details
-
CommandSucceededEvent
public CommandSucceededEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument response, long elapsedTimeNanos) Construct an instance.- Parameters:
requestContext
- the request contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptiondatabaseName
- the database namecommandName
- the command nameresponse
- the command responseelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to complete- Since:
- 4.11
-
CommandSucceededEvent
@Deprecated public CommandSucceededEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) Deprecated.Construct an instance.- Parameters:
requestContext
- the request contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptioncommandName
- the command nameresponse
- the command responseelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to complete- Since:
- 4.10
-
CommandSucceededEvent
@Deprecated public CommandSucceededEvent(@Nullable RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) Deprecated.Construct an instance.- Parameters:
requestContext
- the request contextrequestId
- the request idconnectionDescription
- the connection descriptioncommandName
- the command nameresponse
- the command responseelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to complete- Since:
- 4.4
-
CommandSucceededEvent
@Deprecated public CommandSucceededEvent(int requestId, ConnectionDescription connectionDescription, String commandName, BsonDocument response, long elapsedTimeNanos) Deprecated.Construct an instance.- Parameters:
requestId
- the request idconnectionDescription
- the connection descriptioncommandName
- the command nameresponse
- the command responseelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to completeCommandSucceededEvent(RequestContext, long, int, ConnectionDescription, String, BsonDocument, long)
-
-
Method Details
-
getElapsedTime
Gets the elapsed time in the given unit of time.- Parameters:
timeUnit
- the time unit in which to get the elapsed time- Returns:
- the elapsed time
-
getResponse
Gets the response document. The document is only usable within the method that delivered the event. If it's needed for longer, it must be cloned viaObject.clone()
.- Returns:
- the response document
-
CommandSucceededEvent(RequestContext, long, int, ConnectionDescription, String, String, BsonDocument, long)