Skip to content

Commit eb65777

Browse files
committed
Stackless variant of NoTransactionException for reactive flows
Closes gh-23360
1 parent d587a66 commit eb65777

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionContextManager.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static Mono<TransactionContext> currentContext() throws NoTransactionExce
6262
return;
6363
}
6464
}
65-
sink.error(new NoTransactionException("No transaction in context"));
65+
sink.error(new NoTransactionInContextException());
6666
});
6767
}
6868

@@ -111,4 +111,22 @@ public static Function<Context, Context> getOrCreateContextHolder() {
111111
};
112112
}
113113

114+
115+
/**
116+
* Stackless variant of {@link NoTransactionException} for reactive flows.
117+
*/
118+
@SuppressWarnings("serial")
119+
private static class NoTransactionInContextException extends NoTransactionException {
120+
121+
public NoTransactionInContextException() {
122+
super("No transaction in context");
123+
}
124+
125+
@Override
126+
public synchronized Throwable fillInStackTrace() {
127+
// stackless exception
128+
return this;
129+
}
130+
}
131+
114132
}

0 commit comments

Comments
 (0)