public class ReflectionExecutableTask<REFLECTION_TASK_DESCRIPTOR extends AbstractReflectionLoadedTask> extends AbstractExecutableTask<REFLECTION_TASK_DESCRIPTOR> implements ExecutableTask
It creates a new instance on demand in every execution(apply and rollback), because it's intended to be applied just once. The only case it will be potentially applied twice is if it fails, and in that case will only happen once(in case of sequential execution) or very few times(in case or parallel execution and happen to fail multiple concurrent tasks at the same time),because after that the process will abort.
For this reason it's more optimal to do it on demand, that articulate some synchronisation mechanism.
However, the methods are extracted in advance, so we can spot wrong configuration before starting the process and fail fast.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.reflect.Method |
executionMethod |
protected java.util.List<Rollback> |
rollbackChain |
action, descriptor| Constructor and Description |
|---|
ReflectionExecutableTask(java.lang.String stageName,
REFLECTION_TASK_DESCRIPTOR descriptor,
io.flamingock.internal.common.core.recovery.action.ChangeAction action,
java.lang.reflect.Method executionMethod,
java.lang.reflect.Method rollbackMethod) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRollback(Rollback rollback) |
void |
execute(ExecutionRuntime executionRuntime) |
protected void |
executeInternal(ExecutionRuntime executionRuntime,
java.lang.reflect.Method method) |
java.lang.String |
getExecutionMethodName() |
java.util.List<? extends Rollback> |
getRollbackChain() |
equals, getAction, getAuthor, getDescriptor, getId, getOrder, getRecovery, getSource, getStageName, getTargetSystem, hashCode, isAlreadyApplied, isLegacy, isRunAlways, isSystem, isTransactional, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAction, getDescriptor, getStageName, isAlreadyAppliedprotected final java.lang.reflect.Method executionMethod
protected final java.util.List<Rollback> rollbackChain
public ReflectionExecutableTask(java.lang.String stageName,
REFLECTION_TASK_DESCRIPTOR descriptor,
io.flamingock.internal.common.core.recovery.action.ChangeAction action,
java.lang.reflect.Method executionMethod,
java.lang.reflect.Method rollbackMethod)
public void addRollback(Rollback rollback)
addRollback in interface ExecutableTaskpublic java.util.List<? extends Rollback> getRollbackChain()
getRollbackChain in interface ExecutableTaskpublic void execute(ExecutionRuntime executionRuntime)
execute in interface ExecutableTaskprotected void executeInternal(ExecutionRuntime executionRuntime, java.lang.reflect.Method method)
public java.lang.String getExecutionMethodName()
getExecutionMethodName in interface ExecutableTask