/** * If this method returns false, then local transaction calls like Connection.commit() can be made. * @return true if start() has been successfully called but not end() yet <i>and</i> the transaction is not suspended. */ public boolean isParticipatingInActiveGlobalTransaction() { rwLock.readLock().lock(); try { BitronixTransaction currentTransaction = TransactionContextHelper.currentTransaction(); Uid gtrid = currentTransaction == null ? null : currentTransaction.getResourceManager().getGtrid(); if (gtrid == null) return false; Map<Uid, XAResourceHolderState> statesForGtrid = xaResourceHolderStates.get(gtrid); if (statesForGtrid == null) return false; for (XAResourceHolderState xaResourceHolderState : statesForGtrid.values()) { if (xaResourceHolderState != null && xaResourceHolderState.isStarted() && !xaResourceHolderState.isSuspended() && !xaResourceHolderState.isEnded()) return true; } return false; } finally { rwLock.readLock().unlock(); } }
/** * If this method returns false, then local transaction calls like Connection.commit() can be made. * @return true if start() has been successfully called but not end() yet <i>and</i> the transaction is not suspended. */ public boolean isParticipatingInActiveGlobalTransaction() { rwLock.readLock().lock(); try { BitronixTransaction currentTransaction = TransactionContextHelper.currentTransaction(); Uid gtrid = currentTransaction == null ? null : currentTransaction.getResourceManager().getGtrid(); if (gtrid == null) return false; Map<Uid, XAResourceHolderState> statesForGtrid = xaResourceHolderStates.get(gtrid); if (statesForGtrid == null) return false; for (XAResourceHolderState xaResourceHolderState : statesForGtrid.values()) { if (xaResourceHolderState != null && xaResourceHolderState.isStarted() && !xaResourceHolderState.isSuspended() && !xaResourceHolderState.isEnded()) return true; } return false; } finally { rwLock.readLock().unlock(); } }
/** * If this method returns false, then local transaction calls like Connection.commit() can be made. * @return true if start() has been successfully called but not end() yet <i>and</i> the transaction is not suspended. */ public boolean isParticipatingInActiveGlobalTransaction() { synchronized (xaResourceHolderStates) { BitronixTransaction currentTransaction = TransactionContextHelper.currentTransaction(); Uid gtrid = currentTransaction == null ? null : currentTransaction.getResourceManager().getGtrid(); if (gtrid == null) return false; Map<Uid, XAResourceHolderState> statesForGtrid = xaResourceHolderStates.get(gtrid); if (statesForGtrid == null) return false; for (XAResourceHolderState xaResourceHolderState : statesForGtrid.values()) { if (xaResourceHolderState != null && xaResourceHolderState.isStarted() && !xaResourceHolderState.isSuspended() && !xaResourceHolderState.isEnded()) return true; } return false; } }
/** * If this method returns false, then local transaction calls like Connection.commit() can be made. * @return true if start() has been successfully called but not end() yet <i>and</i> the transaction is not suspended. */ public boolean isParticipatingInActiveGlobalTransaction() { synchronized (xaResourceHolderStates) { BitronixTransaction currentTransaction = TransactionContextHelper.currentTransaction(); Uid gtrid = currentTransaction == null ? null : currentTransaction.getResourceManager().getGtrid(); if (gtrid == null) return false; Map<Uid, XAResourceHolderState> statesForGtrid = xaResourceHolderStates.get(gtrid); if (statesForGtrid == null) return false; for (XAResourceHolderState xaResourceHolderState : statesForGtrid.values()) { if (xaResourceHolderState != null && xaResourceHolderState.isStarted() && !xaResourceHolderState.isSuspended() && !xaResourceHolderState.isEnded()) return true; } return false; } }