return Props.create(ExampleActor.class, id, peerAddresses, configParams);
}
- @Override public void onReceiveCommand(Object message) throws Exception{
+ @Override
+ protected void handleCommand(Object message) {
if(message instanceof KeyValue){
if(isLeader()) {
String persistId = Long.toString(persistIdentifier++);
}
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
}
}
- private ByteString fromObject(Object snapshot) throws Exception {
+ private static ByteString fromObject(Object snapshot) throws Exception {
ByteArrayOutputStream b = null;
ObjectOutputStream o = null;
try {
}
}
- private Object toObject(byte [] bs) throws ClassNotFoundException, IOException {
+ private static Object toObject(byte [] bs) throws ClassNotFoundException, IOException {
Object obj = null;
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
}
- @Override public void onReceiveRecover(Object message)throws Exception {
- super.onReceiveRecover(message);
- }
-
@Override public String persistenceId() {
return getId();
}
}
@Override
- public void handleRecover(Object message) {
+ protected void handleRecover(Object message) {
if(raftRecovery == null) {
raftRecovery = newRaftActorRecoverySupport();
}
}
@Override
- public void handleCommand(final Object message) {
+ protected void handleCommand(final Object message) {
if(serverConfigurationSupport.handleMessage(message, getSender())) {
return;
} else if (message instanceof ApplyState){
}
@Override
- public void handleCommand(final Object message) {
+ protected void handleCommand(final Object message) {
if(message instanceof RaftActorBehavior) {
super.changeCurrentBehavior((RaftActorBehavior)message);
} else {
}
@Override
- public void onReceiveCommand(Object message) throws Exception {
+ public final void onReceiveCommand(Object message) throws Exception {
final String messageType = message.getClass().getSimpleName();
LOG.trace("Received message {}", messageType);
}
@Override
- public void onReceiveRecover(Object message) throws Exception {
+ public final void onReceiveRecover(Object message) throws Exception {
final String messageType = message.getClass().getSimpleName();
LOG.trace("Received message {}", messageType);
handleRecover(message);
}
@Override
- public void onReceiveRecover(final Object message) throws Exception {
+ protected void handleRecover(final Object message) {
LOG.debug("{}: onReceiveRecover: Received message {} from {}", persistenceId(), message.getClass(),
getSender());
- super.onReceiveRecover(message);
+ super.handleRecover(message);
if (LOG.isTraceEnabled()) {
appendEntriesReplyTracker.begin();
}
}
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ protected void handleCommand(final Object message) {
MessageTracker.Context context = appendEntriesReplyTracker.received(message);
} else if(ShardTransactionMessageRetrySupport.TIMER_MESSAGE_CLASS.isInstance(message)) {
messageRetrySupport.onTimerMessage(message);
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
} finally {
context.done();
}
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
if(message instanceof RegisterCandidateLocal) {
onRegisterCandidateLocal((RegisterCandidateLocal) message);
} else if(message instanceof UnregisterCandidateLocal) {
} else if(message instanceof SelectOwner) {
onSelectOwner((SelectOwner) message);
} else if(!commitCoordinator.handleMessage(message, this)) {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
}
@Override
- public void handleRecover(Object message) throws Exception {
+ protected void handleRecover(Object message) throws Exception {
try {
super.handleRecover(message);
} finally {
// it does do a persist)
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
if(message instanceof ElectionTimeout && firstElectionTimeout) {
// Got the first ElectionTimeout. We don't forward it to the
// base Shard yet until we've sent the RegisterChangeListener
onFirstElectionTimeout.countDown();
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
};
public Shard create() throws Exception {
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
if(message instanceof ElectionTimeout && firstElectionTimeout) {
firstElectionTimeout = false;
final ActorRef self = getSelf();
onFirstElectionTimeout.countDown();
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
};
public Shard create() throws Exception {
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
- super.onReceiveCommand(message);
+ public void handleCommand(final Object message) {
+ super.handleCommand(message);
if(message.equals(TX_COMMIT_TIMEOUT_CHECK_MESSAGE)) {
if(cleaupCheckLatch.get() != null) {
cleaupCheckLatch.get().countDown();
}
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
try {
if(dataTree.get() != null && message instanceof GetShardDataTree) {
sender().tell(dataTree.get(), self());
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
} finally {
Class<?> expMsgClass = messageClass.get();
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.candidatePath;
}
@Override
- public void onReceiveCommand(Object message) throws Exception {
+ public void handleCommand(Object message) {
if(!(message instanceof ElectionTimeout)) {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
}