Package com.mongodb.event
Class CommandFailedEvent
java.lang.Object
com.mongodb.event.CommandEvent
com.mongodb.event.CommandFailedEvent
An event representing the failure of a MongoDB database command.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCommandFailedEvent
(int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Deprecated.CommandFailedEvent
(RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Deprecated.CommandFailedEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionlong
getElapsedTime
(TimeUnit timeUnit) Gets the elapsed time in the given unit of time.Gets the throwable cause of the failureMethods inherited from class com.mongodb.event.CommandEvent
getCommandName, getConnectionDescription, getOperationId, getRequestContext, getRequestId
-
Constructor Details
-
CommandFailedEvent
public CommandFailedEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Construct an instance.- Parameters:
requestContext
- the request contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptioncommandName
- the command nameelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to completethrowable
- the throwable cause of the failure- Since:
- 4.10
-
CommandFailedEvent
@Deprecated public CommandFailedEvent(@Nullable RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Deprecated.Construct an instance.- Parameters:
requestContext
- the request contextrequestId
- the requestIdconnectionDescription
- the connection descriptioncommandName
- the command nameelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to completethrowable
- the throwable cause of the failure- Since:
- 4.4
-
CommandFailedEvent
@Deprecated public CommandFailedEvent(int requestId, ConnectionDescription connectionDescription, String commandName, long elapsedTimeNanos, Throwable throwable) Deprecated.Construct an instance.- Parameters:
requestId
- the requestIdconnectionDescription
- the connection descriptioncommandName
- the command nameelapsedTimeNanos
- the non-negative elapsed time in nanoseconds for the operation to completethrowable
- the throwable cause of the failureCommandFailedEvent(RequestContext, long, int, ConnectionDescription, String, long, Throwable)
-
-
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
-
getThrowable
Gets the throwable cause of the failure- Returns:
- the throwable cause of the failuer
-
CommandFailedEvent(RequestContext, long, int, ConnectionDescription, String, long, Throwable)