wt.fc
Class WTCollectionRetrySingleProcessor
java.lang.Object
wt.fc.WTCollectionRetrySingleProcessor
- Direct Known Subclasses:
- StandardPersistenceManager.AbstractInsertUpdateProcessor
- public abstract class WTCollectionRetrySingleProcessor
- extends Object
This class implments a Template Method design pattern for executing a
multi-object operation such that if it fails with an exception, a new
exception can be constructed that will indicate the exact objects that
failed. It does this by executing the "same" operation one object at a time
and building a list of the objects that fail.
The execute(WTCollection)
method executes the multi-object operation,
doMultiOperation(WTCollection)
, in a new Transaction with a savepoint.
If an exception is thrown and it is a target of this instance (determine via
isTargetExceptionType(Exception)
, then the Transaction is rolled back
to the savepoint (i.e. the datastore state prior to the multi-object
operation being executed). Each object is then passed to the
doSingleOperation(Persistable)
and if the same type of exception
occurs, then it is added to a list of failed objects. If an unexpected
exception occurs or the list of failed objects is empty, then the original
exception is thrown. Otherwise, a new exception is built (via
buildNewException(WTCollection)
) and thrown by
execute(WTCollection)
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CLASSNAME
private static final String CLASSNAME
DEBUG
public static final boolean DEBUG
LOG
private static final DebugWriter LOG
persistInfoState
private Object persistInfoState
attributeState
private Object attributeState
WTCollectionRetrySingleProcessor
protected WTCollectionRetrySingleProcessor()
WTCollectionRetrySingleProcessor
protected WTCollectionRetrySingleProcessor(Object a_persistInfoState,
Object a_attributeState)
execute
public void execute(WTCollection a_targets)
throws WTException
- This method executes a multi-object operation.
- Throws:
WTException
doMultiOperation
protected abstract void doMultiOperation(WTCollection a_objects)
throws WTException
- Throws:
WTException
doSingleOperation
protected abstract void doSingleOperation(Persistable a_object)
throws WTException
- Throws:
WTException
isTargetExceptionType
protected abstract boolean isTargetExceptionType(Exception a_exception)
buildNewException
protected abstract WTException buildNewException(WTCollection a_failedObjects)
saveAttributeState
protected Object saveAttributeState(WTCollection a_objects)
resetAttributeState
protected void resetAttributeState(WTCollection a_objects,
Object a_state)