Bump cds-access-api ABIVersion
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / ResponseEnvelope.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.access.concepts;
9
10 import com.google.common.base.Preconditions;
11
12 public abstract class ResponseEnvelope<T extends Response<?, ?>> extends Envelope<T> {
13     private static final long serialVersionUID = 1L;
14
15     private final long executionTimeNanos;
16
17     ResponseEnvelope(final T message, final long sessionId, final long txSequence, final long executionTimeNanos) {
18         super(message, sessionId, txSequence);
19         Preconditions.checkArgument(executionTimeNanos >= 0);
20         this.executionTimeNanos = executionTimeNanos;
21     }
22
23     /**
24      * Return the time the request took to execute in nanoseconds. This may not reflect the actual CPU time, but rather
25      * a measure of the complexity involved in servicing the original request.
26      *
27      * @return Time the request took to execute in nanoseconds
28      */
29     public final long getExecutionTimeNanos() {
30         return executionTimeNanos;
31     }
32
33     @Override
34     abstract AbstractResponseEnvelopeProxy<T> createProxy();
35 }