public class QueueTask extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
className
java class name
|
protected long |
createTime
time stamp when task was created/added to the queue
|
protected long |
endTime
time task finished
|
protected Long |
executionTime
Execution time ...
|
protected Integer |
generation |
protected String |
job
to JSON string serialized task
|
protected Long |
jobRunTime
Time job took to execute (pure job execution time) from: running to: success/fail
is null when not run
is != null if run (shows last execution run time)
|
protected String |
lockFilter
Joined values of QueueName + locked state to enable filtering
|
protected String |
queue
queue name
|
protected int |
runCount
count of tasks runs 0 - tasks was never run, 1 - task was run once, 2 - run once / and once retried ...
|
protected long |
startTime
time task was started
|
protected TaskState |
state
internal task state ...
|
protected String |
stateFilter
Joined values of QueueName + TaskState to enable filtering
|
protected long |
updateTime
time stamp when task was last updated
|
| Modifier | Constructor and Description |
|---|---|
protected |
QueueTask()
For Spikeify only
|
|
QueueTask(Job newJob,
String queueName)
Creates new queue task entity holding a task to be stored into database
|
| Modifier and Type | Method and Description |
|---|---|
String |
getClassName() |
Long |
getCreateTime() |
long |
getEndTime() |
Long |
getExecutionTime() |
String |
getId() |
Job |
getJob()
Creates instance of task object from JSON task and className
(task class must be serializable/deserializable from to JSON string)
|
Long |
getJobRunTime() |
static String |
getLockedFilter(String queueName,
boolean locked)
Utility method to get correct filter for equals filtering searching for open/closed tasks
|
String |
getQueue() |
int |
getRunCount() |
long |
getStartTime() |
TaskState |
getState() |
static String |
getStateFilter(String queueName,
TaskState taskState)
Utility method to get correct filter for equals filtering searching for task state
|
Long |
getUpdateTime() |
boolean |
isLocked() |
boolean |
isOlderThan(int ageInMinutes)
Compares last update time with current time ...
|
boolean |
isOlderThanSeconds(int ageInSeconds)
Compares last update time with current time ...
|
void |
setState(TaskState newState)
Change the tasks state when started, failed of finished
|
String |
toString() |
protected void |
updateFilter()
Filter is composed of queue name and locked state
this allows filtering of tasks per queue and state, for instance:
- get all queued or failed tasks for default queue
- get all running or finished tasks for "my" queue ...
|
protected Integer generation
protected String queue
protected String job
protected String className
protected long createTime
protected long updateTime
protected long startTime
protected long endTime
protected Long executionTime
protected Long jobRunTime
protected TaskState state
protected int runCount
protected String stateFilter
protected String lockFilter
public Job getJob()
public String getId()
public String getClassName()
public long getStartTime()
public long getEndTime()
public Long getCreateTime()
public Long getUpdateTime()
public Long getJobRunTime()
public Long getExecutionTime()
public TaskState getState()
public String getQueue()
public void setState(TaskState newState)
newState - to put task into. If transition is not possible set is ignored!public int getRunCount()
public boolean isLocked()
protected void updateFilter()
public static String getLockedFilter(String queueName, boolean locked)
queueName - name of queuelocked - statepublic static String getStateFilter(String queueName, TaskState taskState)
queueName - name of queuetaskState - statepublic boolean isOlderThan(int ageInMinutes)
ageInMinutes - number of minutes to pass (age)public boolean isOlderThanSeconds(int ageInSeconds)
ageInSeconds - number of seconds to pass (age)Copyright © 2015–2016. All rights reserved.