public class NoOpCompensationContext extends Object implements CompensationContext
Constructor and Description |
---|
NoOpCompensationContext() |
Modifier and Type | Method and Description |
---|---|
void |
resetCompensation()
Signify that the command does not need the compensation data which has been recorded up to this point, and if an
error occurs after this point then compensation will handle only the entities which were snapshot after this
point.
|
void |
snapshotEntity(BusinessEntity<?> entity)
Save a snapshot of the entire entity before it is changed/deleted in the DB, so that it can be restored later on
in case of compensation.
|
void |
snapshotEntityStatus(BusinessEntity<?> entity,
Enum<?> status)
Snapshot the entity status only, so that in case of compensation for the entity, the status will be updated to
it's original value.
|
void |
snapshotNewEntity(BusinessEntity<?> entity)
Save a snapshot of a new entity that was added to the DB, so that if there's need for compensation it will be
deleted from the DB.
|
void |
stateChanged()
Signify that the command state had changed and the transaction is about to end, so that the snapshots can
be saved to the DB (in order to reduce lock time on the compensations table).
|
public void snapshotEntity(BusinessEntity<?> entity)
CompensationContext
snapshotEntity
in interface CompensationContext
entity
- The entity state before the change.public void snapshotNewEntity(BusinessEntity<?> entity)
CompensationContext
snapshotNewEntity
in interface CompensationContext
entity
- The new entity which was added.public void snapshotEntityStatus(BusinessEntity<?> entity, Enum<?> status)
CompensationContext
snapshotEntityStatus
in interface CompensationContext
entity
- The entity for which to save the status snapshot.status
- The status to snapshot.public void stateChanged()
CompensationContext
stateChanged
in interface CompensationContext
public void resetCompensation()
CompensationContext
resetCompensation
in interface CompensationContext
Copyright © 2012. All Rights Reserved.