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 org.opendaylight.yangtools.concepts.WritableObjects;
15 abstract class AbstractResponseEnvelopeProxy<T extends Response<?, ?>> extends AbstractEnvelopeProxy<T> {
16 private static final long serialVersionUID = 1L;
18 private long executionTimeNanos;
20 AbstractResponseEnvelopeProxy() {
24 AbstractResponseEnvelopeProxy(final ResponseEnvelope<T> envelope) {
26 this.executionTimeNanos = envelope.getExecutionTimeNanos();
30 public final void writeExternal(final ObjectOutput out) throws IOException {
31 super.writeExternal(out);
32 WritableObjects.writeLong(out, executionTimeNanos);
36 public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
37 super.readExternal(in);
38 executionTimeNanos = WritableObjects.readLong(in);
42 final ResponseEnvelope<T> createEnvelope(final T message, final long sessionId, final long txSequence) {
43 return createEnvelope(message, sessionId, txSequence, executionTimeNanos);
46 @SuppressWarnings("checkstyle:hiddenField")
47 abstract ResponseEnvelope<T> createEnvelope(T message, long sessionId, long txSequence, long executionTimeNanos);