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()
Task
public String getGroupId()
Task
getGroupId
in interface Task
public TaskResource getTaskResource()
Task
TaskResource
for this task. Task resources define specific
worker requirements a task may require.getTaskResource
in interface Task
TaskResource
for this taskpublic String getNodeType()
Task
getNodeType
in interface Task
public String getDataSource()
Task
getDataSource
in interface Task
public <T> QueryRunner<T> getQueryRunner(Query<T> query)
Task
getQueryRunner
in interface Task
T
- query result typepublic String getClasspathPrefix()
Task
getClasspathPrefix
in interface Task
public boolean canRestore()
Task
canRestore
in interface Task
public void stopGracefully()
Task
Task.canRestore()
returns true. Tasks that take too long to stop gracefully will be terminated with
extreme prejudice.stopGracefully
in interface Task
public static String joinId(Object... objects)
objects
- objects to joinpublic TaskStatus success()
protected Iterable<TaskLock> getTaskLocks(TaskToolbox toolbox) throws IOException
IOException
public Map<String,Object> getContext()
getContext
in interface Task
public Object getContextValue(String key)
getContextValue
in interface Task
Copyright © 2011–2017. All rights reserved.