CloudletTask

public abstract class CloudletTask implements Identifiable

Represents one of many tasks that can be executed by a NetworkCloudlet.

Please refer to following publication for more details:

Author:Saurabh Kumar Garg

Constructors

CloudletTask

public CloudletTask(int id)

Creates a new task.

Parameters:
  • id – task id

Methods

getCloudlet

public NetworkCloudlet getCloudlet()

Gets the NetworkCloudlet that the task belongs to.

getExecutionTime

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

getFinishTime

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

getId

public long getId()

Gets the id of the CloudletTask.

getMemory

public long getMemory()

Gets the memory amount used by the task.

getStartTime

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

isActive

public boolean isActive()

Indicates if the task is active (it’s not finished).

Returns:true if the task is active, false otherwise

See also: .isFinished()

isExecutionTask

public boolean isExecutionTask()

isFinished

public boolean isFinished()

Indicates if the task is finished or not.

Returns:true if the task has finished, false otherwise

See also: .isActive()

isReceiveTask

public boolean isReceiveTask()

isSendTask

public boolean isSendTask()

setCloudlet

public CloudletTask setCloudlet(NetworkCloudlet cloudlet)

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

setId

public CloudletTask setId(int id)

Sets the id of the CloudletTask.

Parameters:
  • id – the ID to set

setMemory

public CloudletTask setMemory(long memory)

Sets the memory amount used by the task.

Parameters:
  • memory – the memory amount to set

setStartTime

public CloudletTask setStartTime(double startTime)

Sets the time the task started executing.

Parameters:
  • startTime – the start time to set