Class CloudletTask

java.lang.Object
org.cloudbus.cloudsim.cloudlets.network.CloudletTask
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
CloudletExecutionTask, CloudletReceiveTask, CloudletSendTask

public abstract class CloudletTask extends Object implements Identifiable
Since:
CloudSim Toolkit 1.0 TODO Classes CloudletTask, Cloudlet and CloudletExecution share a common set of attributes that would be defined by a common interface.
Author:
Saurabh Kumar Garg
  • Constructor Details

    • CloudletTask

      public CloudletTask(int id)
      Creates a new task.
      Parameters:
      id - task id
  • Method Details

    • getId

      public long getId()
      Gets the id of the task.
      Specified by:
      getId in interface Identifiable
      Returns:
    • setId

      public CloudletTask setId(int id)
      Sets the id of the task.
      Parameters:
      id - the ID to set
    • getMemory

      public long getMemory()
      Gets the memory amount used by the task (in Megabytes).
      Returns:
    • setMemory

      public CloudletTask setMemory(long memory)
      Sets the memory amount used by the task (in Megabytes).
      Parameters:
      memory - the memory amount to set
    • getStartTime

      public double getStartTime()
      Returns:
      the time the task started executing (in seconds), or -1 if not started yet.
    • setStartTime

      public CloudletTask setStartTime(double startTime)
      Sets the time the task started executing (in seconds).
      Parameters:
      startTime - the start time to set
    • getCloudlet

      public NetworkCloudlet getCloudlet()
      Gets the NetworkCloudlet that the task belongs to.
      Returns:
    • setCloudlet

      public CloudletTask setCloudlet(NetworkCloudlet cloudlet)
    • isFinished

      public boolean isFinished()
      Checks if the task is finished or not.
      Returns:
      true if the task has finished, false otherwise
      See Also:
    • isActive

      public boolean isActive()
      Checks if the task is active (it's not finished).
      Returns:
      true if the task is active, false otherwise
      See Also:
    • setFinished

      protected void setFinished(boolean finished)
      Sets the task as finished or not
      Parameters:
      finished - true to set the task as finished, false otherwise
      Throws:
      RuntimeException - when the task is already finished and you try to set it as unfinished
    • getExecutionTime

      public double getExecutionTime()
      Returns:
      the time the task spent executing (in seconds), or -1 if not finished yet
    • getFinishTime

      public double getFinishTime()
      Returns:
      the time the task finished (in seconds) or -1 if not finished yet.
    • isExecutionTask

      public boolean isExecutionTask()
    • isSendTask

      public boolean isSendTask()
    • isReceiveTask

      public boolean isReceiveTask()