Suspending and Resuming Transactions

vFabric GemFire APIs provide the ability to suspend and resume transactions. The ability to suspend and resume is useful when a thread must perform some operations that should not be part of the transaction before the transaction can complete.

When a transaction is suspended, it loses the transactional view of the cache. None of the previous operations (before calling suspend) are visible to the thread. Subsequently any operations that are performed by the thread do not participate in the suspended transaction.

When a transaction is resumed, the resuming thread assumes the transactional view. A transaction that is suspending on a member must be resumed on the same member. Before resuming a transaction, you may want to check if the transaction exists on the member and whether it is suspended. You may optionally use the tryResume method.

If the member with the primary copy of the data crashes, the transactional view that applied to that data is lost. The secondary member for the data will not be able to resume any transactions suspended on the crashed member. You will need to take remedial steps to retry the transaction on a new primary copy of the data.

If a suspended transaction is not touched for a period of time, GemFire cleans it up automatically. By default, the timeout for a suspended transaction is 30 minutes and can be configured using the system property gemfire.suspendedtxTimeout. For example, to modify the default, you could set gemfire.suspendedtxTimeout=60 (time in minutes).

See Basic Suspend and Resume Transaction Example for an example of how to suspend and resume a transaction.