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.client;
10 import static java.util.Objects.requireNonNull;
13 * Forwarder class responsible for routing requests from the previous connection incarnation back to the originator,
14 * which can then convert them as appropriate.
16 * @author Robert Varga
18 public abstract class ReconnectForwarder {
19 // Visible for subclass method handle
20 private final AbstractReceivingClientConnection<?> successor;
22 protected ReconnectForwarder(final AbstractReceivingClientConnection<?> successor) {
23 this.successor = requireNonNull(successor);
26 protected final void sendToSuccessor(final ConnectionEntry entry) {
27 successor.sendRequest(entry.getRequest(), entry.getCallback());
30 protected final void replayToSuccessor(final ConnectionEntry entry) {
31 successor.enqueueRequest(entry.getRequest(), entry.getCallback(), entry.getEnqueuedTicks());
34 protected abstract void forwardEntry(ConnectionEntry entry, long now);
36 protected abstract void replayEntry(ConnectionEntry entry, long now);
38 final AbstractReceivingClientConnection<?> successor() {