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

    Constructors
    Constructor
    Description
    Client(int clientId, List<akka.actor.ActorRef> group, int numberOfNodes)
    Constructor for the Client actor.
  • Method Summary

    Modifier and Type
    Method
    Description
    akka.actor.AbstractActor.Receive
    Mask for to the Client actor.
    void
    Initial set up for the Client.
    static akka.actor.Props
    props(int clientId, List<akka.actor.ActorRef> group, int numberOfNodes)
    Wrapper for the Client actor.
    void
    tell(akka.actor.ActorRef dest, Object msg, akka.actor.ActorRef sender)
    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

      public Client(int clientId, List<akka.actor.ActorRef> group, int numberOfNodes)
      Constructor for the Client actor.
      Parameters:
      clientId - the client id
      group - the list of Nodes in the network
      numberOfNodes - 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 id
      group - the list of Nodes in the network
      numberOfNodes - 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 class akka.actor.AbstractActor
      Returns:
      the Receive object
    • onStartMessage

      public void onStartMessage(Utils.StartMessage msg)
      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

      public void tell(akka.actor.ActorRef dest, Object msg, akka.actor.ActorRef sender)
      Send a message to a destination actor with a random delay, within 0 and 29 milliseconds.
      Parameters:
      dest - the destination actor
      msg - the message to send
      sender - the sender actor