Enlarge critical section to cover processNextTransaction()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / behaviors / DelegatingRaftActorBehavior.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.raft.behaviors;
9
10 import akka.actor.ActorRef;
11 import org.opendaylight.controller.cluster.raft.RaftState;
12
13 /**
14  * A RaftActorBehavior implementation that delegates to another implementation.
15  *
16  * @author Thomas Pantelis
17  */
18 public class DelegatingRaftActorBehavior implements RaftActorBehavior {
19     private RaftActorBehavior delegate;
20
21     public RaftActorBehavior getDelegate() {
22         return delegate;
23     }
24
25     public void setDelegate(RaftActorBehavior delegate) {
26         this.delegate = delegate;
27     }
28
29     @Override
30     public void close() throws Exception {
31         delegate.close();
32     }
33
34     @Override
35     public RaftActorBehavior handleMessage(ActorRef sender, Object message) {
36         return delegate.handleMessage(sender, message);
37     }
38
39     @Override
40     public RaftState state() {
41         return delegate.state();
42     }
43
44     @Override
45     public String getLeaderId() {
46         return delegate.getLeaderId();
47     }
48
49     @Override
50     public void setReplicatedToAllIndex(long replicatedToAllIndex) {
51         delegate.setReplicatedToAllIndex(replicatedToAllIndex);
52     }
53
54     @Override
55     public long getReplicatedToAllIndex() {
56         return delegate.getReplicatedToAllIndex();
57     }
58
59     @Override
60     public short getLeaderPayloadVersion() {
61         return delegate.getLeaderPayloadVersion();
62     }
63
64     @Override
65     public RaftActorBehavior switchBehavior(RaftActorBehavior behavior) {
66         return delegate.switchBehavior(behavior);
67     }
68 }