* shared workspace cache.
*/
@Override
public void checkForTransaction() {
try {
Transactions transactions = sessionContext.getTransactions();
Transaction txn = transactions.getTransactionManager().getTransaction();
if (txn != null && txn.getStatus() == Status.STATUS_ACTIVE) {
// There is an active transaction, so we need a transaction-specific workspace cache ...
workspaceCache.set(sessionContext.getTransactionalWorkspaceCacheFactory()
.getTransactionalWorkspaceCache(sharedWorkspaceCache));
// only register the function if there's an active ModeShape transaction because we need to run the
// function *only after* ISPN has committed its transaction & updated the cache
// if there isn't an active ModeShape transaction, one will become active later during "save"
// otherwise, "save" is never called meaning this cache should be discarded
Transactions.Transaction modeshapeTx = transactions.currentTransaction();
if (modeshapeTx != null) {
if (this.completeTransactionFunction.get() == null) {
// create and register the complete transaction function only once
this.completeTransactionFunction.compareAndSet(null, new Transactions.TransactionFunction() {
@Override