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;
11 import java.io.Serial;
13 public abstract class ResponseEnvelope<T extends Response<?, ?>> extends Envelope<T> {
15 private static final long serialVersionUID = 1L;
17 private final long executionTimeNanos;
19 ResponseEnvelope(final T message, final long sessionId, final long txSequence, final long executionTimeNanos) {
20 super(message, sessionId, txSequence);
21 Preconditions.checkArgument(executionTimeNanos >= 0);
22 this.executionTimeNanos = executionTimeNanos;
26 * Return the time the request took to execute in nanoseconds. This may not reflect the actual CPU time, but rather
27 * a measure of the complexity involved in servicing the original request.
29 * @return Time the request took to execute in nanoseconds
31 public final long getExecutionTimeNanos() {
32 return executionTimeNanos;
36 abstract AbstractResponseEnvelopeProxy<T> createProxy();