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 java.lang.Object implements Identifiable
Represents one of many tasks that can be executed by a
NetworkCloudlet
.
Please refer to following publication for more details:
- Since:
- CloudSim Toolkit 1.0
- Author:
- Saurabh Kumar Garg
- To do something:
- Classes
CloudletTask
,Cloudlet
andCloudletExecution
share a common set of attributes that would be defined by a common interface.
-
Constructor Summary
Constructors Constructor Description CloudletTask(int id)
Creates a new task. -
Method Summary
Modifier and Type Method Description NetworkCloudlet
getCloudlet()
Gets the NetworkCloudlet that the task belongs to.double
getExecutionTime()
double
getFinishTime()
long
getId()
Gets the id of the CloudletTask.long
getMemory()
Gets the memory amount used by the task.double
getStartTime()
boolean
isActive()
Indicates if the task is active (it's not finished).boolean
isExecutionTask()
boolean
isFinished()
Indicates if the task is finished or not.boolean
isReceiveTask()
boolean
isSendTask()
CloudletTask
setCloudlet(NetworkCloudlet cloudlet)
protected void
setFinished(boolean finished)
Sets the task as finished or notCloudletTask
setId(int id)
Sets the id of the CloudletTask.CloudletTask
setMemory(long memory)
Sets the memory amount used by the task.CloudletTask
setStartTime(double startTime)
Sets the time the task started executing.
-
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 CloudletTask.- Specified by:
getId
in interfaceIdentifiable
- Returns:
-
setId
Sets the id of the CloudletTask.- Parameters:
id
- the ID to set
-
getMemory
public long getMemory()Gets the memory amount used by the task.- Returns:
-
setMemory
Sets the memory amount used by the task.- Parameters:
memory
- the memory amount to set
-
getStartTime
public double getStartTime()- Returns:
- the time the task started executing, or -1 if not started yet.
-
setStartTime
Sets the time the task started executing.- Parameters:
startTime
- the start time to set
-
getCloudlet
Gets the NetworkCloudlet that the task belongs to.- Returns:
-
setCloudlet
-
isFinished
public boolean isFinished()Indicates if the task is finished or not.- Returns:
- true if the task has finished, false otherwise
- See Also:
isActive()
-
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()
-
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:
java.lang.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, or -1 if not finished yet
-
getFinishTime
public double getFinishTime()- Returns:
- the time the task finished or -1 if not finished yet.
-
isExecutionTask
public boolean isExecutionTask() -
isSendTask
public boolean isSendTask() -
isReceiveTask
public boolean isReceiveTask()
-