@NotThreadSafe public abstract class ChangeExecutorBase<CONFIG extends ChangeExecutorConfiguration> extends Object implements Executor
| Modifier and Type | Field and Description |
|---|---|
protected Function<AnnotatedElement,Boolean> |
annotationFilter |
protected ChangeLogRuntime |
changeLogRuntime |
protected ChangeLogServiceBase |
changeLogService |
protected Deque<Triple<Object,ChangeSetItem,Exception>> |
changeSetsToRollBack |
protected CONFIG |
config |
protected ConnectionDriver |
driver |
protected List<ChangeEntryExecuted> |
executedChangeEntries |
protected String |
executionId |
protected boolean |
executionInProgress |
protected Boolean |
globalTransactionEnabled |
protected Map<String,Object> |
metadata |
protected String |
serviceIdentifier |
protected boolean |
trackIgnored |
| Constructor and Description |
|---|
ChangeExecutorBase(String executionId,
ChangeLogServiceBase changeLogService,
ConnectionDriver driver,
ChangeLogRuntime changeLogRuntime,
Function<AnnotatedElement,Boolean> annotationFilter,
Map<String,Object> metadata,
String serviceIdentifier,
boolean trackIgnored,
Optional<Boolean> transactional,
Optional<Boolean> transactionEnabled,
TransactionStrategy transactionStrategy,
CONFIG config) |
| Modifier and Type | Method and Description |
|---|---|
protected ChangeEntry |
buildChangeEntry(String executionId,
String executionHostname,
ChangeSetItem changeSetItem,
long executionTimeMillis,
ChangeState state,
ChangeType type) |
protected ChangeEntry |
buildChangeEntry(String executionId,
String executionHostname,
ChangeSetItem changeSetItem,
long executionTimeMillis,
ChangeState state,
ChangeType type,
Exception executionException,
Exception rollbackException) |
protected void |
clearChangeSetsToRollbackIfApply(boolean applyPreparation) |
protected void |
executeAndLogChangeSet(String executionId,
String executionHostname,
Object changelogInstance,
ChangeSetItem changeSetItem) |
protected long |
executeChangeSetMethod(Method changeSetMethod,
Object changeLogInstance) |
protected String |
generateExecutionHostname(String executionId) |
protected Object |
getChangeLogInstance(Class<?> changeLogClass) |
protected void |
initializationAndValidation() |
protected boolean |
isAlreadyExecuted(ChangeSetItem changeSetItem) |
protected boolean |
isDriverTransactional() |
boolean |
isExecutionInProgress() |
protected boolean |
isStrategyPerChangeUnit() |
protected boolean |
isStrategyPerMigration() |
protected boolean |
isThereAnyChangeSetItemToBeExecuted(Collection<ChangeLogItem> changeLogs) |
protected boolean |
isThereAnyChangeSetItemToBeRolledBack(Collection<ChangeLogItem> changeLogs) |
protected void |
loadExecutedChangeEntries() |
protected void |
logIgnoredChangeLogs(Collection<ChangeLogItem> changeLogs) |
protected void |
logIgnoredChangeSet(ChangeSetItem changeSetItem) |
protected void |
loopRawChangeSets(String executionId,
String executionHostName,
Object changeLogInstance,
ChangeLogItem changeLog,
List<? extends ChangeSetItem> changeSets) |
protected void |
prepareChangeLogService() |
protected void |
prepareForStageExecutionIfApply(boolean applyPreparation) |
protected void |
processChangeLogInTransactionIfApplies(String executionId,
String executionHostname,
Object changeLogInstance,
ChangeLogItem changeLog) |
protected void |
processChangeLogs(String executionId,
String executionHostname,
Collection<ChangeLogItem> changeLogs) |
protected void |
processExceptionOnChangeSetExecution(Exception exception,
ChangeSetItem changeSetItem,
boolean throwException) |
protected void |
processMigration(Collection<ChangeLogItem> changeLogs,
String executionId,
String executionHostname) |
protected void |
processSingleChangeLog(String executionId,
String executionHostname,
ChangeLogItem changeLog) |
protected void |
processSingleChangeSet(String executionId,
String executionHostname,
Object changeLogInstance,
ChangeSetItem changeSet) |
protected void |
rollbackIfPresentAndTrackChangeEntry(String executionId,
String executionHostname,
Object changeLogInstance,
ChangeSetItem changeSetItem,
Exception changeSetException) |
protected void |
rollbackProcessedChangeSetsIfApply(String executionId,
String hostname,
Deque<Triple<Object,ChangeSetItem,Exception>> processedChangeSets)
changeSetsToRollBack collection contains "all and only" the changeSets to rollback "manually" in case of any
exception occurs, sorted in reverse order.
|
protected abstract void |
validateChangeLog(ChangeLogItem changeLog) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteMigrationprotected final Boolean globalTransactionEnabled
protected final Deque<Triple<Object,ChangeSetItem,Exception>> changeSetsToRollBack
protected final ChangeLogServiceBase changeLogService
protected final ConnectionDriver driver
protected final String serviceIdentifier
protected final boolean trackIgnored
protected final ChangeLogRuntime changeLogRuntime
protected final Function<AnnotatedElement,Boolean> annotationFilter
protected boolean executionInProgress
protected final String executionId
protected final CONFIG extends ChangeExecutorConfiguration config
protected List<ChangeEntryExecuted> executedChangeEntries
public ChangeExecutorBase(String executionId, ChangeLogServiceBase changeLogService, ConnectionDriver driver, ChangeLogRuntime changeLogRuntime, Function<AnnotatedElement,Boolean> annotationFilter, Map<String,Object> metadata, String serviceIdentifier, boolean trackIgnored, Optional<Boolean> transactional, Optional<Boolean> transactionEnabled, TransactionStrategy transactionStrategy, CONFIG config)
public boolean isExecutionInProgress()
isExecutionInProgress in interface Executorprotected void processMigration(Collection<ChangeLogItem> changeLogs, String executionId, String executionHostname)
protected void processChangeLogs(String executionId, String executionHostname, Collection<ChangeLogItem> changeLogs)
protected abstract void validateChangeLog(ChangeLogItem changeLog)
protected void processSingleChangeLog(String executionId, String executionHostname, ChangeLogItem changeLog)
protected void processChangeLogInTransactionIfApplies(String executionId, String executionHostname, Object changeLogInstance, ChangeLogItem changeLog)
protected void loopRawChangeSets(String executionId, String executionHostName, Object changeLogInstance, ChangeLogItem changeLog, List<? extends ChangeSetItem> changeSets)
protected void rollbackProcessedChangeSetsIfApply(String executionId, String hostname, Deque<Triple<Object,ChangeSetItem,Exception>> processedChangeSets)
scenarios for the changeSetsToRollBack collection - strategy == MIGRATION and transactional: It should be empty, as all the changeSets, before included, should be rollBacked in the transaction. - strategy == MIGRATION and non-transactional: It should contain all the executed changeSets in the entire migration, main and before, in execution reverse order - strategy == CHANGE_LOG and transactional: It should contain only the before methods executed for the current changeLog - strategy == CHANGE_LOG and non-transactional: It should contain all the executed changeSets in the current changeLog, main and before, in execution reverse order
protected void processSingleChangeSet(String executionId, String executionHostname, Object changeLogInstance, ChangeSetItem changeSet)
protected boolean isThereAnyChangeSetItemToBeExecuted(Collection<ChangeLogItem> changeLogs)
protected boolean isThereAnyChangeSetItemToBeRolledBack(Collection<ChangeLogItem> changeLogs)
protected boolean isAlreadyExecuted(ChangeSetItem changeSetItem)
protected void executeAndLogChangeSet(String executionId, String executionHostname, Object changelogInstance, ChangeSetItem changeSetItem) throws IllegalAccessException, InvocationTargetException
protected void rollbackIfPresentAndTrackChangeEntry(String executionId, String executionHostname, Object changeLogInstance, ChangeSetItem changeSetItem, Exception changeSetException) throws InvocationTargetException, IllegalAccessException
protected void logIgnoredChangeSet(ChangeSetItem changeSetItem)
protected void logIgnoredChangeLogs(Collection<ChangeLogItem> changeLogs)
protected ChangeEntry buildChangeEntry(String executionId, String executionHostname, ChangeSetItem changeSetItem, long executionTimeMillis, ChangeState state, ChangeType type)
protected ChangeEntry buildChangeEntry(String executionId, String executionHostname, ChangeSetItem changeSetItem, long executionTimeMillis, ChangeState state, ChangeType type, Exception executionException, Exception rollbackException)
protected long executeChangeSetMethod(Method changeSetMethod, Object changeLogInstance) throws IllegalAccessException, InvocationTargetException
protected void processExceptionOnChangeSetExecution(Exception exception, ChangeSetItem changeSetItem, boolean throwException)
protected void initializationAndValidation()
throws MongockException
MongockExceptionprotected void loadExecutedChangeEntries()
protected final boolean isDriverTransactional()
protected final boolean isStrategyPerChangeUnit()
protected final boolean isStrategyPerMigration()
protected void prepareForStageExecutionIfApply(boolean applyPreparation)
protected void clearChangeSetsToRollbackIfApply(boolean applyPreparation)
protected void prepareChangeLogService()
Copyright © 2025. All rights reserved.