org.apache.oozie.command.wf
Class ActionCommand<T>
java.lang.Object
org.apache.oozie.command.Command<T,WorkflowStore>
org.apache.oozie.command.wf.WorkflowCommand<Void>
org.apache.oozie.command.wf.ActionCommand<T>
- All Implemented Interfaces:
- Callable<Void>, XCallable<Void>
- Direct Known Subclasses:
- ActionCheckCommand, ActionEndCommand, ActionKillCommand, ActionStartCommand
public abstract class ActionCommand<T>
- extends WorkflowCommand<Void>
Base class for Action execution commands. Provides common functionality to handle different types of errors while
attempting to start or end an action.
Method Summary |
protected void |
addActionCron(String type,
Instrumentation.Cron cron)
|
void |
failJob(ActionExecutor.Context context)
|
protected void |
handleError(ActionExecutor.Context context,
ActionExecutor executor,
String message,
boolean isStart,
WorkflowAction.Status status)
Takes care of errors. |
protected void |
handleNonTransient(WorkflowStore store,
ActionExecutor.Context context,
ActionExecutor executor,
WorkflowAction.Status status)
Takes care of non transient failures. |
protected boolean |
handleTransient(ActionExecutor.Context context,
ActionExecutor executor,
WorkflowAction.Status status)
Takes care of Transient failures. |
protected void |
incrActionCounter(String type,
int count)
|
Methods inherited from class org.apache.oozie.command.Command |
call, call, execute, getCreatedTime, getInstrumentation, getName, getPriority, getType, incrCommandCounter, incrJobCounter, incrJobCounter, lock, logQueueCallableFalse, queueCallable, queueCallable, queueCallable, queueCallableForException, resetLogInfoAction, resetLogInfoWorkflow, setLogInfo, setLogInfo, setLogInfo, setLogInfo, toString |
INSTR_FAILED_JOBS_COUNTER
protected static final String INSTR_FAILED_JOBS_COUNTER
- See Also:
- Constant Field Values
RECOVERY_ID_SEPARATOR
protected static final String RECOVERY_ID_SEPARATOR
- See Also:
- Constant Field Values
ActionCommand
public ActionCommand(String name,
String type,
int priority)
handleTransient
protected boolean handleTransient(ActionExecutor.Context context,
ActionExecutor executor,
WorkflowAction.Status status)
throws StoreException,
CommandException
- Takes care of Transient failures. Sets the action status to retry and increments the retry count if not enough
attempts have been made. Otherwise returns false.
- Parameters:
context
- the execution context.executor
- the executor instance being used.status
- the status to be set for the action.
- Returns:
- true if the action is scheduled for another retry. false if the number of retries has exceeded the
maximum number of configured retries.
- Throws:
StoreException
CommandException
handleNonTransient
protected void handleNonTransient(WorkflowStore store,
ActionExecutor.Context context,
ActionExecutor executor,
WorkflowAction.Status status)
throws StoreException,
CommandException
- Takes care of non transient failures. The job is suspended, and the state of the action is changed to *MANUAL
and set pending flag of action to false
- Parameters:
store
- WorkflowStorecontext
- the execution context.executor
- the executor instance being used.status
- the status to be set for the action.
- Throws:
StoreException
CommandException
handleError
protected void handleError(ActionExecutor.Context context,
ActionExecutor executor,
String message,
boolean isStart,
WorkflowAction.Status status)
throws CommandException
- Takes care of errors. For errors while attempting to start the action, the job state is updated and an
ActionEndCommand
is queued. For errors while attempting to end the action, the job state is updated.
- Parameters:
context
- the execution context.executor
- the executor instance being used.message
- isStart
- whether the error was generated while starting or ending an action.status
- the status to be set for the action.
- Throws:
CommandException
failJob
public void failJob(ActionExecutor.Context context)
throws CommandException
- Throws:
CommandException
incrActionCounter
protected void incrActionCounter(String type,
int count)
addActionCron
protected void addActionCron(String type,
Instrumentation.Cron cron)
Copyright © 2011 Yahoo. All Rights Reserved.