public abstract class AbstractTask extends Object implements Task
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTask(String id,
String dataSource,
Map<String,Object> context) |
protected |
AbstractTask(String id,
String groupId,
String dataSource,
Map<String,Object> context) |
protected |
AbstractTask(String id,
String groupId,
TaskResource taskResource,
String dataSource,
Map<String,Object> context) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRestore()
Returns whether or not this task can restore its progress from its on-disk working directory.
|
boolean |
equals(Object o) |
String |
getClasspathPrefix()
Returns an extra classpath that should be prepended to the default classpath when running this task.
|
Map<String,Object> |
getContext() |
Object |
getContextValue(String key) |
String |
getDataSource()
Returns the datasource this task operates on.
|
String |
getGroupId()
Returns group ID of this task.
|
String |
getId()
Returns ID of this task.
|
String |
getNodeType()
Get the nodeType for if/when this task publishes on zookeeper.
|
<T> QueryRunner<T> |
getQueryRunner(Query<T> query)
Returns query runners for this task.
|
protected Iterable<TaskLock> |
getTaskLocks(TaskToolbox toolbox) |
TaskResource |
getTaskResource()
Returns a
TaskResource for this task. |
int |
hashCode() |
static String |
joinId(Object... objects)
Start helper methods
|
static String |
makeId(String id,
String typeName,
String dataSource,
org.joda.time.Interval interval) |
void |
stopGracefully()
Asks a task to arrange for its "run" method to exit promptly.
|
TaskStatus |
success() |
String |
toString() |
protected AbstractTask(String id, String groupId, String dataSource, Map<String,Object> context)
public static String makeId(String id, String typeName, String dataSource, org.joda.time.Interval interval)
public String getId()
Taskpublic String getGroupId()
TaskgetGroupId in interface Taskpublic TaskResource getTaskResource()
TaskTaskResource for this task. Task resources define specific
worker requirements a task may require.getTaskResource in interface TaskTaskResource for this taskpublic String getNodeType()
TaskgetNodeType in interface Taskpublic String getDataSource()
TaskgetDataSource in interface Taskpublic <T> QueryRunner<T> getQueryRunner(Query<T> query)
TaskgetQueryRunner in interface TaskT - query result typepublic String getClasspathPrefix()
TaskgetClasspathPrefix in interface Taskpublic boolean canRestore()
TaskcanRestore in interface Taskpublic void stopGracefully()
TaskTask.canRestore() returns true. Tasks that take too long to stop gracefully will be terminated with
extreme prejudice.stopGracefully in interface Taskpublic static String joinId(Object... objects)
objects - objects to joinpublic TaskStatus success()
protected Iterable<TaskLock> getTaskLocks(TaskToolbox toolbox) throws IOException
IOExceptionpublic Map<String,Object> getContext()
getContext in interface Taskpublic Object getContextValue(String key)
getContextValue in interface TaskCopyright © 2011–2017. All rights reserved.