File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,23 @@ static void rollback() {
6969
7070 /**
7171 * If a transaction is active.
72+ * A transaction is considered active after it has been started and prior to a Coordinator issuing any prepares, unless the
73+ * transaction has been marked for rollback
7274 *
73- * @return {@code true} if the transaction is active .
75+ * @return {@code true} if the transaction is in the {@link Status#STATUS_ACTIVE} state .
7476 */
7577 static boolean isActive () {
78+ return getStatus () == Status .STATUS_ACTIVE ;
79+ }
80+
81+ /**
82+ * Returns the status of the current transaction.
83+ *
84+ * @return The status of the current transaction based on the {@link Status} constants.
85+ */
86+ static int getStatus () {
7687 try {
77- return UserTransaction .userTransaction ().getStatus () != Status . STATUS_NO_TRANSACTION ;
88+ return UserTransaction .userTransaction ().getStatus ();
7889 } catch (SystemException e ) {
7990 throw new QuarkusTransactionException (e );
8091 }
@@ -86,11 +97,7 @@ static boolean isActive() {
8697 * @return If the transaction has been marked for rollback
8798 */
8899 static boolean isRollbackOnly () {
89- try {
90- return UserTransaction .userTransaction ().getStatus () == Status .STATUS_MARKED_ROLLBACK ;
91- } catch (SystemException e ) {
92- throw new QuarkusTransactionException (e );
93- }
100+ return getStatus () == Status .STATUS_MARKED_ROLLBACK ;
94101 }
95102
96103 /**
You can’t perform that action at this time.
0 commit comments