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() {
69
69
70
70
/**
71
71
* 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
72
74
*
73
- * @return {@code true} if the transaction is active .
75
+ * @return {@code true} if the transaction is in the {@link Status#STATUS_ACTIVE} state .
74
76
*/
75
77
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 () {
76
87
try {
77
- return UserTransaction .userTransaction ().getStatus () != Status . STATUS_NO_TRANSACTION ;
88
+ return UserTransaction .userTransaction ().getStatus ();
78
89
} catch (SystemException e ) {
79
90
throw new QuarkusTransactionException (e );
80
91
}
@@ -86,11 +97,7 @@ static boolean isActive() {
86
97
* @return If the transaction has been marked for rollback
87
98
*/
88
99
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 ;
94
101
}
95
102
96
103
/**
You can’t perform that action at this time.
0 commit comments