Bump cds-access-api ABIVersion
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / RequestEnvelope.java
index 1c6e72c59a6596ea498cad2dbc432fd63934101b..46d5d1f99620b83304b49e7d160a6648768dce65 100644 (file)
@@ -25,10 +25,12 @@ public final class RequestEnvelope extends Envelope<Request<?, ?>> {
      * Respond to this envelope with a {@link RequestFailure} caused by specified {@link RequestException}.
      *
      * @param cause Cause of this {@link RequestFailure}
+     * @param executionTimeNanos Time to execute the request, in nanoseconds
      * @throws NullPointerException if cause is null
      */
-    public void sendFailure(final RequestException cause) {
-        sendResponse(new FailureEnvelope(getMessage().toRequestFailure(cause), getSessionId(), getTxSequence()));
+    public void sendFailure(final RequestException cause, final long executionTimeNanos) {
+        sendResponse(new FailureEnvelope(getMessage().toRequestFailure(cause), getSessionId(), getTxSequence(),
+            executionTimeNanos));
     }
 
     /**
@@ -37,8 +39,19 @@ public final class RequestEnvelope extends Envelope<Request<?, ?>> {
      * @param success Successful response
      * @throws NullPointerException if success is null
      */
-    public void sendSuccess(final RequestSuccess<?, ?> success) {
-        sendResponse(new SuccessEnvelope(success, getSessionId(), getTxSequence()));
+    public void sendSuccess(final RequestSuccess<?, ?> success, final long executionTimeNanos) {
+        sendResponse(newSuccessEnvelope(success, executionTimeNanos));
+    }
+
+    /**
+     * Creates a successful ResponseEnvelope that wraps the given successful Request response message.
+     *
+     * @param success the successful Request response message
+     * @param executionTimeNanos the execution time of the request
+     * @return a {@link ResponseEnvelope} instance
+     */
+    public ResponseEnvelope<?> newSuccessEnvelope(final RequestSuccess<?, ?> success, final long executionTimeNanos) {
+        return new SuccessEnvelope(success, getSessionId(), getTxSequence(), executionTimeNanos);
     }
 
     private void sendResponse(final ResponseEnvelope<?> envelope) {