2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.access.concepts;
10 import com.google.common.base.Preconditions;
12 public abstract class ResponseEnvelope<T extends Response<?, ?>> extends Envelope<T> {
13 private static final long serialVersionUID = 1L;
15 private final long executionTimeNanos;
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;
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.
27 * @return Time the request took to execute in nanoseconds
29 public final long getExecutionTimeNanos() {
30 return executionTimeNanos;
34 abstract AbstractResponseEnvelopeProxy<T> createProxy();