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 java.io.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
13 import java.io.Serial;
14 import org.opendaylight.yangtools.concepts.WritableObjects;
16 abstract class AbstractResponseEnvelopeProxy<T extends Response<?, ?>> extends AbstractEnvelopeProxy<T> {
18 private static final long serialVersionUID = 1L;
20 private long executionTimeNanos;
22 AbstractResponseEnvelopeProxy() {
26 AbstractResponseEnvelopeProxy(final ResponseEnvelope<T> envelope) {
28 this.executionTimeNanos = envelope.getExecutionTimeNanos();
32 public final void writeExternal(final ObjectOutput out) throws IOException {
33 super.writeExternal(out);
34 WritableObjects.writeLong(out, executionTimeNanos);
38 public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
39 super.readExternal(in);
40 executionTimeNanos = WritableObjects.readLong(in);
44 final ResponseEnvelope<T> createEnvelope(final T message, final long sessionId, final long txSequence) {
45 return createEnvelope(message, sessionId, txSequence, executionTimeNanos);
48 @SuppressWarnings("checkstyle:hiddenField")
49 abstract ResponseEnvelope<T> createEnvelope(T message, long sessionId, long txSequence, long executionTimeNanos);