Package it.unitn.disi.ds1.qtop
Class Node
java.lang.Object
akka.actor.AbstractActor
it.unitn.disi.ds1.qtop.Node
- All Implemented Interfaces:
akka.actor.Actor
public class Node
extends akka.actor.AbstractActor
Node class, it represents a single node in the network. It can be either receiver or coordinator.
During the election all the nodes become voters.
-
Nested Class Summary
Nested classes/interfaces inherited from class akka.actor.AbstractActor
akka.actor.AbstractActor.ActorContext, akka.actor.AbstractActor.Receive
Nested classes/interfaces inherited from interface akka.actor.Actor
akka.actor.Actor.emptyBehavior$, akka.actor.Actor.ignoringBehavior$
-
Constructor Summary
ConstructorDescriptionNode
(akka.actor.ActorRef coordinator, int nodeId, int voteTimeout, int writeTimeout, int electionGlobalTimeout, int numberOfNodes) Constructor for the Node class. -
Method Summary
Modifier and TypeMethodDescriptionakka.actor.AbstractActor.Receive
Mask for to the Receiver actor.static akka.actor.Props
props
(akka.actor.ActorRef coordinator, int nodeId, int voteTimeout, int writeTimeout, int electionGlobalTimeout, int numberOfNodes) Create the Props for the Node class.void
Send a message to a destination actor with a random delay, within 0 and 29 milliseconds.Methods inherited from class akka.actor.AbstractActor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, emptyBehavior, getContext, getSelf, getSender, postRestart, postStop, preRestart, preRestart, preStart, receive, receiveBuilder, self, supervisorStrategy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, sender, unhandled
-
Constructor Details
-
Node
public Node(akka.actor.ActorRef coordinator, int nodeId, int voteTimeout, int writeTimeout, int electionGlobalTimeout, int numberOfNodes) Constructor for the Node class.- Parameters:
coordinator
- the coordinator ActorRefnodeId
- the node IDvoteTimeout
- the vote timeoutwriteTimeout
- the write timeoutelectionGlobalTimeout
- the global election timeoutnumberOfNodes
- the number of nodes in the network
-
-
Method Details
-
props
public static akka.actor.Props props(akka.actor.ActorRef coordinator, int nodeId, int voteTimeout, int writeTimeout, int electionGlobalTimeout, int numberOfNodes) Create the Props for the Node class.- Parameters:
coordinator
- the coordinator ActorRefnodeId
- the node IDvoteTimeout
- the vote timeoutwriteTimeout
- the write timeoutelectionGlobalTimeout
- the global election timeoutnumberOfNodes
- the number of nodes in the network- Returns:
- the Props object
-
tell
Send a message to a destination actor with a random delay, within 0 and 29 milliseconds.- Parameters:
dest
- the destination actormsg
- the message to sendsender
- the sender actor
-
createReceive
public akka.actor.AbstractActor.Receive createReceive()Mask for to the Receiver actor.- Specified by:
createReceive
in classakka.actor.AbstractActor
- Returns:
- the Receive object
-