public abstract class AbstractSubscriptionScheduledActionCmdImpl extends TaskCommandImpl implements SubscriptionScheduledActionCmd
Modifier and Type | Class and Description |
---|---|
static class | AbstractSubscriptionScheduledActionCmdImpl.StackEntry
This class represents an entry in the command's state processing stack.
|
Modifier and Type | Field and Description |
---|---|
static int | MAX_RETRIES_FOR_SUBSCRIPTION_STATE_UPDATE
Constant representing the number of times a state update needs to be retried before failing.
|
Constructor and Description |
---|
AbstractSubscriptionScheduledActionCmdImpl() |
Modifier and Type | Method and Description |
---|---|
TypedProperty | getActionParameters()
This method returns the action parameters for the scheduled action.
|
protected java.lang.Throwable | getExceptionForFailure()
This method returns the cause for the failure of this command.
|
protected abstract java.lang.Integer | getFinalStateForSubscription()
This abstract method returns the final state the subscription is to be updated to.
|
protected abstract java.lang.Integer | getInitialState()
This method is to be overridden to get the initial transient start for the scheduled action.
|
protected abstract int | getMaximumNumberOfRetriesForState(java.lang.Integer state)
This method is to be overridden by the sub classes to provide the maximum number of retries for the processing state.
|
protected int | getMaximumRetriesForStateUpdate()
This method returns the maximum number of retries for a state change before failing the action.
|
protected java.lang.Long | getScheduledAction()
This method returns the scheduled action being carried by this command.
|
java.lang.Long | getSubscriptionId()
This method returns the unique ID of the subscription being processed.
|
protected abstract void | handleStateRetry(AbstractSubscriptionScheduledActionCmdImpl.StackEntry stateToRetry)
This abstract method is to be overridden by the sub classes to handle the retry of a state that failed to process.
|
void | initialize()
This method initializes the task command.By default this method does nothing.
|
protected boolean | isExceptionRetriable(java.lang.Exception exceptionToCheck)
This method is to be overridden by the sub classes to check for exceptions which can be retried.
|
void | performExecute()
This method executes the business logic required for carrying out the scheduled action.
|
protected abstract void | processSubscriptionState(AbstractSubscriptionScheduledActionCmdImpl.StackEntry entry)
This abstract method is to be overridden by the sub classes to provide the implementation to process a state.
|
protected abstract void | recoverState(AbstractSubscriptionScheduledActionCmdImpl.StackEntry completedState)
This abstract method is to be overridden by the sub classes to provide the implementation to recover or roll back the completed state specified.
|
protected void | rollBackAndUpdateState(java.lang.Integer newState)
This method rolls back the current transaction and updates the state of the subscription.
|
void | setActionParameters(TypedProperty actionParameters)
Sets the action parameters for the scheduled action.
|
void | setExeceptionForFailure(java.lang.Throwable cause)
This method sets the exception which caused the failure for this command.
|
void | setScheduledAction(java.lang.Long scheduledActionID)
Sets the Subscrschjobs object instance which represents the scheduled action being executed.
|
void | setSubscriptionId(java.lang.Long subscriptionId)
Sets the subscription ID being processed.
|
protected void | updateState(java.lang.Integer newState)
This method updates the state of the subscription.
|
protected java.lang.Integer | updateSubscriptionState(java.lang.Integer newState, boolean isTransient)
This method updates the state of the subscription with retries.
|
public static final int MAX_RETRIES_FOR_SUBSCRIPTION_STATE_UPDATE
public AbstractSubscriptionScheduledActionCmdImpl()
public void initialize() throws java.lang.Exception
protected abstract java.lang.Integer getInitialState()
public void setActionParameters(TypedProperty actionParameters)
public void setScheduledAction(java.lang.Long scheduledActionID)
public void setSubscriptionId(java.lang.Long subscriptionId)
public java.lang.Long getSubscriptionId()
public TypedProperty getActionParameters()
public final void performExecute() throws ECException
Any failures during processing would trigger the recovery mechanism after retries. After the recovery mechanism is completed, the method throws a SubscriptionSystemException with _ERR_EXECUTION_OF_SCHEDULED_ACTION_FAILED as the message key.
Once the scheduled action is processed successfully through the transient states, this method resets the transient state in the subscription table and updates the subscription to the final state as returned by the getFinalStateForSubscription method. Any failure while updating the subscription state after retries would result in a SubscriptionSystemException with _ERR_EXECUTION_OF_SCHEDULED_ACTION_FAILED_SUCCESSFULLY.
public void setExeceptionForFailure(java.lang.Throwable cause)
protected java.lang.Throwable getExceptionForFailure()
protected java.lang.Long getScheduledAction()
protected void updateState(java.lang.Integer newState)
protected void rollBackAndUpdateState(java.lang.Integer newState)
protected int getMaximumRetriesForStateUpdate()
protected final java.lang.Integer updateSubscriptionState(java.lang.Integer newState, boolean isTransient)
protected abstract void recoverState(AbstractSubscriptionScheduledActionCmdImpl.StackEntry completedState)
protected abstract void handleStateRetry(AbstractSubscriptionScheduledActionCmdImpl.StackEntry stateToRetry)
protected abstract java.lang.Integer getFinalStateForSubscription()
protected abstract void processSubscriptionState(AbstractSubscriptionScheduledActionCmdImpl.StackEntry entry)
protected abstract int getMaximumNumberOfRetriesForState(java.lang.Integer state)
protected boolean isExceptionRetriable(java.lang.Exception exceptionToCheck)