org.apache.oozie.command.wf
Class SuspendXCommand

java.lang.Object
  extended by org.apache.oozie.command.XCommand<T>
      extended by org.apache.oozie.command.wf.WorkflowXCommand<Void>
          extended by org.apache.oozie.command.wf.SuspendXCommand
All Implemented Interfaces:
Callable<Void>, XCallable<Void>

public class SuspendXCommand
extends WorkflowXCommand<Void>


Field Summary
 
Fields inherited from class org.apache.oozie.command.XCommand
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, dryrun, eventService, instrumentation, INSTRUMENTATION_GROUP, LOG, logInfo
 
Constructor Summary
SuspendXCommand(String id)
           
 
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  Void execute()
          Command execution body.
 String getEntityKey()
          Return the entity key for the command.
 String getKey()
          Get command key
protected  boolean isLockRequired()
          Indicate if the the command requires locking.
protected  void loadState()
          Load the necessary state to perform the precondition check and to execute the command.
static void suspendJob(JPAService jpaService, WorkflowJobBean workflow, String id, String actionId, List<JsonBean> updateList)
          Suspend the workflow job and pending flag to false for the actions that are START_RETRY or START_MANUAL or END_RETRY or END_MANUAL
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.wf.WorkflowXCommand
generateEvent, generateEvent, generateEvent
 
Methods inherited from class org.apache.oozie.command.XCommand
call, executeInterrupts, getCreatedTime, getInstrumentation, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isReQueueRequired, queue, queue, resetUsed, setInterruptMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuspendXCommand

public SuspendXCommand(String id)
Method Detail

execute

protected Void 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.

Specified by:
execute in class XCommand<Void>
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.

suspendJob

public static void suspendJob(JPAService jpaService,
                              WorkflowJobBean workflow,
                              String id,
                              String actionId,
                              List<JsonBean> updateList)
                       throws WorkflowException,
                              CommandException
Suspend the workflow job and pending flag to false for the actions that are START_RETRY or START_MANUAL or END_RETRY or END_MANUAL

Parameters:
jpaService - jpa service
workflow - workflow job
id - workflow job id
actionId - workflow action id
Throws:
WorkflowException - thrown if failed to suspend workflow instance
CommandException - thrown if unable set pending false for actions

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<Void>
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<Void>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException

getEntityKey

public String getEntityKey()
Description copied from class: XCommand
Return the entity key for the command.

Specified by:
getEntityKey in interface XCallable<Void>
Specified by:
getEntityKey in class XCommand<Void>
Returns:
the entity key for the command.

getKey

public String getKey()
Description copied from class: XCommand
Get command key

Specified by:
getKey in interface XCallable<Void>
Overrides:
getKey in class XCommand<Void>
Returns:
command key

isLockRequired

protected boolean isLockRequired()
Description copied from class: XCommand
Indicate if the the command requires locking.

Subclasses should override this method if they require locking.

Specified by:
isLockRequired in class XCommand<Void>
Returns:
true/false

loadState

protected void loadState()
                  throws CommandException
Description copied from class: XCommand
Load the necessary state to perform the precondition check and to execute the command.

Subclasses must implement this method and load the state needed to do the precondition check and execute the command.

Specified by:
loadState in class XCommand<Void>
Throws:
CommandException

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<Void>
Throws:
CommandException - thrown if the precondition is not met.
PreconditionException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.