import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.ReceiveTimeout;
-import akka.actor.UntypedActor;
+import akka.actor.UntypedAbstractActor;
import com.google.common.base.Preconditions;
import java.util.concurrent.TimeoutException;
-import org.apache.commons.lang3.SerializationUtils;
import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply;
import org.opendaylight.controller.cluster.raft.client.messages.GetSnapshotReply;
*
* @author Thomas Pantelis
*/
-class GetSnapshotReplyActor extends UntypedActor {
+class GetSnapshotReplyActor extends UntypedAbstractActor {
private static final Logger LOG = LoggerFactory.getLogger(GetSnapshotReplyActor.class);
private final Params params;
- private GetSnapshotReplyActor(Params params) {
+ GetSnapshotReplyActor(final Params params) {
this.params = params;
getContext().setReceiveTimeout(params.receiveTimeout);
}
@Override
- public void onReceive(Object message) {
+ public void onReceive(final Object message) {
if (message instanceof CaptureSnapshotReply) {
Snapshot snapshot = Snapshot.create(
((CaptureSnapshotReply)message).getSnapshotState(),
LOG.debug("{}: Received CaptureSnapshotReply, sending {}", params.id, snapshot);
- params.replyToActor.tell(new GetSnapshotReply(params.id, SerializationUtils.serialize(snapshot)),
- getSelf());
+ params.replyToActor.tell(new GetSnapshotReply(params.id, snapshot), getSelf());
getSelf().tell(PoisonPill.getInstance(), getSelf());
} else if (message instanceof ReceiveTimeout) {
LOG.warn("{}: Got ReceiveTimeout for inactivity - did not receive CaptureSnapshotReply within {} ms",
}
}
- public static Props props(CaptureSnapshot captureSnapshot, ElectionTerm electionTerm, ActorRef replyToActor,
- Duration receiveTimeout, String id, ServerConfigurationPayload updatedPeerInfo) {
+ public static Props props(final CaptureSnapshot captureSnapshot, final ElectionTerm electionTerm,
+ final ActorRef replyToActor, final Duration receiveTimeout, final String id,
+ final ServerConfigurationPayload updatedPeerInfo) {
return Props.create(GetSnapshotReplyActor.class, new Params(captureSnapshot, electionTerm, replyToActor,
receiveTimeout, id, updatedPeerInfo));
}
final String id;
final ServerConfigurationPayload peerInformation;
- Params(CaptureSnapshot captureSnapshot, ElectionTerm electionTerm, ActorRef replyToActor,
- Duration receiveTimeout, String id, ServerConfigurationPayload peerInfo) {
+ Params(final CaptureSnapshot captureSnapshot, final ElectionTerm electionTerm, final ActorRef replyToActor,
+ final Duration receiveTimeout, final String id, final ServerConfigurationPayload peerInfo) {
this.captureSnapshot = Preconditions.checkNotNull(captureSnapshot);
this.electionTerm = Preconditions.checkNotNull(electionTerm);
this.replyToActor = Preconditions.checkNotNull(replyToActor);