mirror of
https://github.com/google/nomulus
synced 2026-01-03 19:54:18 +00:00
Enable nested transaction warning in production (#2628)
Knonw nested transact calls found in sandbox have been refactored away. Enable logging in production to catch any missing cases. Logging is throttled at 1 message per minute per VM.
This commit is contained in:
@@ -71,6 +71,7 @@ import java.util.NoSuchElementException;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -177,9 +178,9 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager {
|
|||||||
if (!getHibernateAllowNestedTransactions()) {
|
if (!getHibernateAllowNestedTransactions()) {
|
||||||
throw new IllegalStateException(NESTED_TRANSACTION_MESSAGE);
|
throw new IllegalStateException(NESTED_TRANSACTION_MESSAGE);
|
||||||
}
|
}
|
||||||
if (RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION
|
if (RegistryEnvironment.get() != RegistryEnvironment.UNITTEST) {
|
||||||
&& RegistryEnvironment.get() != RegistryEnvironment.UNITTEST) {
|
logger.atWarning().withStackTrace(StackSize.MEDIUM).atMostEvery(1, TimeUnit.MINUTES).log(
|
||||||
logger.atWarning().withStackTrace(StackSize.MEDIUM).log(NESTED_TRANSACTION_MESSAGE);
|
NESTED_TRANSACTION_MESSAGE);
|
||||||
}
|
}
|
||||||
// This prevents inner transaction from retrying, thus avoiding a cascade retry effect.
|
// This prevents inner transaction from retrying, thus avoiding a cascade retry effect.
|
||||||
return transactNoRetry(isolationLevel, work);
|
return transactNoRetry(isolationLevel, work);
|
||||||
|
|||||||
Reference in New Issue
Block a user