Package it.unitn.disi.ds1.qtop
Class Client
java.lang.Object
akka.actor.AbstractActor
it.unitn.disi.ds1.qtop.Client
- All Implemented Interfaces:
akka.actor.Actor
public class Client
extends akka.actor.AbstractActor
The Client actor is responsible for sending requests to the Nodes in the network. The requests are randomised
between read and write operations. The Client actor also has the ability to make crash a random Node in the network.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionakka.actor.AbstractActor.Receive
Mask for to the Client actor.void
Initial set up for the Client.static akka.actor.Props
Wrapper for the Client actor.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
-
Client
Constructor for the Client actor.- Parameters:
clientId
- the client idgroup
- the list of Nodes in the networknumberOfNodes
- the number of Nodes in the network
-
-
Method Details
-
props
public static akka.actor.Props props(int clientId, List<akka.actor.ActorRef> group, int numberOfNodes) Wrapper for the Client actor.- Parameters:
clientId
- the client idgroup
- the list of Nodes in the networknumberOfNodes
- the number of Nodes in the network- Returns:
- the Props object
-
createReceive
public akka.actor.AbstractActor.Receive createReceive()Mask for to the Client actor.- Specified by:
createReceive
in classakka.actor.AbstractActor
- Returns:
- the Receive object
-
onStartMessage
Initial set up for the Client. It sets up a scheduled message to send requests to the `Node`s.- Parameters:
msg
- the init message
-
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
-