CloudletReceiveTask

public class CloudletReceiveTask extends CloudletTask

A task executed by a NetworkCloudlet that receives data from a CloudletSendTask. Each receiver task expects to receive packets from just one VM.

Please refer to following publication for more details:

Author:Saurabh Kumar Garg, Manoel Campos da Silva Filho

Constructors

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

Methods

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.

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.

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

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