org.apache.oozie.command
Class RerunTransitionXCommand<T>

java.lang.Object
  extended by org.apache.oozie.command.XCommand<T>
      extended by org.apache.oozie.command.TransitionXCommand<T>
          extended by org.apache.oozie.command.RerunTransitionXCommand<T>
Type Parameters:
T -
All Implemented Interfaces:
Callable<T>, XCallable<T>
Direct Known Subclasses:
BundleRerunXCommand, CoordRerunXCommand

public abstract class RerunTransitionXCommand<T>
extends TransitionXCommand<T>

Transition command for rerun the job. The derived class has to override these following functions:

updateJob() : update job status and attributes rerunChildren() : submit or queue commands to rerun children notifyParent() : update the status to upstream if any


Field Summary
protected  String jobId
           
protected  org.apache.oozie.client.Job.Status prevStatus
           
protected  T ret
           
 
Fields inherited from class org.apache.oozie.command.TransitionXCommand
insertList, job, updateList
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, dryrun, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
RerunTransitionXCommand(String name, String type, int priority)
          The constructor for abstract class RerunTransitionXCommand
RerunTransitionXCommand(String name, String type, int priority, boolean dryrun)
          The constructor for abstract class RerunTransitionXCommand
 
Method Summary
protected  void eagerLoadState()
          Load the necessary state to perform an eager precondition check.
protected  void eagerVerifyPrecondition()
          Verify the precondition for the command before obtaining a lock.
protected  T execute()
          Command execution body.
 org.apache.oozie.client.Job.Status getPrevStatus()
          This method will return the previous status.
abstract  void rerunChildren()
          Rerun actions associated with the job
 void transitToNext()
          Transit to the next status based on the result of the Job.
protected  void verifyPrecondition()
          Verify the precondition for the command after a lock has been obtain, just before executing the command.
 
Methods inherited from class org.apache.oozie.command.TransitionXCommand
getJob, notifyParent, performWrites, setJob, updateJob
 
Methods inherited from class org.apache.oozie.command.XCommand
call, executeInterrupts, getCreatedTime, getEntityKey, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isLockRequired, isReQueueRequired, loadState, queue, queue, resetUsed, setInterruptMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobId

protected String jobId

ret

protected T ret

prevStatus

protected org.apache.oozie.client.Job.Status prevStatus
Constructor Detail

RerunTransitionXCommand

public RerunTransitionXCommand(String name,
                               String type,
                               int priority)
The constructor for abstract class RerunTransitionXCommand

Parameters:
name - the command name
type - the command type
priority - the command priority

RerunTransitionXCommand

public RerunTransitionXCommand(String name,
                               String type,
                               int priority,
                               boolean dryrun)
The constructor for abstract class RerunTransitionXCommand

Parameters:
name - the command name
type - the command type
priority - the command priority
dryrun - true if dryrun is enable
Method Detail

transitToNext

public void transitToNext()
Description copied from class: TransitionXCommand
Transit to the next status based on the result of the Job.

Specified by:
transitToNext in class TransitionXCommand<T>

rerunChildren

public abstract void rerunChildren()
                            throws CommandException
Rerun actions associated with the job

Throws:
CommandException - thrown if failed to rerun actions

execute

protected T execute()
             throws CommandException
Description copied from class: XCommand
Command execution body.

This method will be invoked after the {link #loadState} and {link #verifyPrecondition} methods.

If the command requires locking, this method will be invoked ONLY if the lock has been acquired.

Overrides:
execute in class TransitionXCommand<T>
Returns:
a return value from the execution of the command, only meaningful if the command is executed synchronously.
Throws:
CommandException - thrown if the command execution failed.

verifyPrecondition

protected void verifyPrecondition()
                           throws CommandException,
                                  PreconditionException
Description copied from class: XCommand
Verify the precondition for the command after a lock has been obtain, just before executing the command.

Specified by:
verifyPrecondition in class XCommand<T>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

eagerLoadState

protected void eagerLoadState()
                       throws CommandException
Description copied from class: XCommand
Load the necessary state to perform an eager precondition check.

This implementation does a NOP.

Subclasses should override this method and load the state needed to do an eager precondition check.

A trivial implementation is calling {link #loadState}.

Overrides:
eagerLoadState in class XCommand<T>
Throws:
CommandException

eagerVerifyPrecondition

protected void eagerVerifyPrecondition()
                                throws CommandException,
                                       PreconditionException
Description copied from class: XCommand
Verify the precondition for the command before obtaining a lock.

This implementation does a NOP.

A trivial implementation is calling {link #verifyPrecondition}.

Overrides:
eagerVerifyPrecondition in class XCommand<T>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

getPrevStatus

public org.apache.oozie.client.Job.Status getPrevStatus()
This method will return the previous status.

Returns:
JOB Status


Copyright © 2013 Apache Software Foundation. All Rights Reserved.