All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.controller.cluster.access.concepts.AbstractResponseEnvelopeProxy Maven / Gradle / Ivy

/*
 * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.controller.cluster.access.concepts;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.opendaylight.yangtools.concepts.WritableObjects;

abstract class AbstractResponseEnvelopeProxy> extends AbstractEnvelopeProxy {
    private static final long serialVersionUID = 1L;

    private long executionTimeNanos;

    AbstractResponseEnvelopeProxy() {
        // for Externalizable
    }

    AbstractResponseEnvelopeProxy(final ResponseEnvelope envelope) {
        super(envelope);
        this.executionTimeNanos = envelope.getExecutionTimeNanos();
    }

    @Override
    public final void writeExternal(final ObjectOutput out) throws IOException {
        super.writeExternal(out);
        WritableObjects.writeLong(out, executionTimeNanos);
    }

    @Override
    public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
        super.readExternal(in);
        executionTimeNanos = WritableObjects.readLong(in);
    }

    @Override
    final ResponseEnvelope createEnvelope(final T message, final long sessionId, final long txSequence) {
        return createEnvelope(message, sessionId, txSequence, executionTimeNanos);
    }

    @SuppressWarnings("checkstyle:hiddenField")
    abstract ResponseEnvelope createEnvelope(T message, long sessionId, long txSequence, long executionTimeNanos);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy