Class CloudletReceiveTask

java.lang.Object
org.cloudbus.cloudsim.cloudlets.network.CloudletTask
org.cloudbus.cloudsim.cloudlets.network.CloudletReceiveTask
All Implemented Interfaces:
Identifiable

public class CloudletReceiveTask
extends CloudletTask
Since:
CloudSim Toolkit 1.0
Author:
Saurabh Kumar Garg, Manoel Campos da Silva Filho
To do something:
For how long will the task be waiting for packets? The sender task has a defined amount of packets to send, but the receiver doesn't have to know how many packets to wait for. Considering a real distributed app such as a web app, the sender can be a browser and the receiver a web server. In this case, the web server runs indefinitely. However, the simulation has to have a time interval. For instance, it may be simulated the operation of this distributed app for 24 hours. By this way, the receiver task could have a specific amount of time to run. In the web app scenario, the web server just keep running, waiting for any client to send packets to it, but it is not required that a client do that. The web app may not be accessed during this time. By other hand, the client may send packets to the server and require a response. It will so wait for this response and has to have a timeout period so that the client can skip waiting to receive an answer and move to the next task or finish. Each task has to have a status (such as the Cloudlet itself) to define if it was executed successfully or not. For instance, a receive ask that is waiting to receive a list of packets can be configured to finish after a given timeout without receiving the expected packets. How is the network delay being computed?
  • Constructor Details

    • CloudletReceiveTask

      public CloudletReceiveTask​(int id, Vm sourceVm)
      Creates a new task.
      Parameters:
      id - task id
      sourceVm - the Vm where it is expected to receive packets from
  • Method Details

    • receivePacket

      public void receivePacket​(VmPacket packet)
      Receives a packet sent from a CloudletSendTask and add it the the received packet list.
      Parameters:
      packet - the packet received
    • getPacketsReceived

      public List<VmPacket> getPacketsReceived()
      Gets the list of packets received.
      Returns:
      a read-only received packet list
    • getSourceVm

      public Vm getSourceVm()
      Gets the Vm where it is expected to receive packets from.
      Returns:
    • getExpectedPacketsToReceive

      public long getExpectedPacketsToReceive()
      Gets the number of packets that are expected to be received. After this number of packets is received, the task is marked as finished.
      Returns:
    • setExpectedPacketsToReceive

      public void setExpectedPacketsToReceive​(long expectedPacketsToReceive)
      Sets the number of packets that are expected to be received. After this number of packets is received, the task is marked as finished.
      Parameters:
      expectedPacketsToReceive - the number of expected packets to set