docs: @Override
      public void checkForTransaction() throws SystemException {
          try {
              Transactions transactions = repositoryEnvironment.getTransactions();
              javax.transaction.Transaction txn = transactions.getTransactionManager().getTransaction();
              if (txn != null && txn.getStatus() == Status.STATUS_ACTIVE) {
                  WorkspaceCache workspaceCache = getWorkspace();
                  if (workspaceCache instanceof TransactionalWorkspaceCache) {
                      // we're already inside a transaction and have a tx workspace cache set
                      return;
                  }
                  // There is an active transaction, so we need a transaction-specific workspace cache ...
                  setWorkspaceCache(txWorkspaceCaches.getTransactionalCache(workspaceCache));
                  // only register the function if there's an active ModeShape transaction because we need to run the
                  // function *only after* the persistent storage has been updated
                  // 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
                  Transaction modeshapeTx = transactions.currentTransaction();
                  if (modeshapeTx != null) {
                      String txId = modeshapeTx.id();
                      Map<String, Transactions.TransactionFunction> funcsByTxId = 
                              COMPLETE_FUNCTION_BY_TX_AND_WS.computeIfAbsent(txId, transactionId -> new ConcurrentHashMap<>());
                      funcsByTxId.computeIfAbsent(workspaceName(), wsName -> {
                          Transactions.TransactionFunction completeFunction = () -> completeTransaction(txId, wsName);
                          modeshapeTx.uponCompletion(completeFunction);
                          return completeFunction;
                      });                     
                  }
              } else {
                  // There is no active transaction, so just use the shared workspace cache ...
                  // reset the ws cache to the shared (global one)
                  setWorkspaceCache(sharedWorkspaceCache());
              }
          } catch (SystemException e) {
              logger.error(e, JcrI18n.errorDeterminingCurrentTransactionAssumingNone, workspaceName(), e.getMessage());
              throw e;
          }
      }