Skip to content

Commit 13221ac

Browse files
committed
Merge branch '6.1.x'
# Conflicts: # spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java # spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java
2 parents 40da093 + 0955f54 commit 13221ac

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import java.util.concurrent.ScheduledThreadPoolExecutor;
2828
import java.util.concurrent.TimeUnit;
2929

30+
import org.apache.commons.logging.LogFactory;
31+
3032
import org.springframework.context.ApplicationContext;
3133
import org.springframework.context.ApplicationContextAware;
3234
import org.springframework.context.ApplicationListener;
@@ -191,12 +193,21 @@ protected void doExecute(Runnable task) {
191193
}
192194
}
193195

196+
private Runnable taskOnSchedulerThread(Runnable task) {
197+
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true));
198+
}
199+
194200
private Runnable scheduledTask(Runnable task) {
195-
return () -> execute(new DelegatingErrorHandlingRunnable(task, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
201+
return () -> execute(new DelegatingErrorHandlingRunnable(task, this::shutdownAwareErrorHandler));
196202
}
197203

198-
private Runnable taskOnSchedulerThread(Runnable task) {
199-
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true));
204+
private void shutdownAwareErrorHandler(Throwable ex) {
205+
if (this.scheduledExecutor.isTerminated()) {
206+
LogFactory.getLog(getClass()).debug("Ignoring scheduled task exception after shutdown", ex);
207+
}
208+
else {
209+
TaskUtils.getDefaultErrorHandler(true).handleError(ex);
210+
}
200211
}
201212

202213

spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ void gh24291TransactionManagerViaQualifierAnnotation() {
286286

287287
ctx.close();
288288
}
289+
289290
@Test
290-
void spr14322FindsOnInterfaceWithInterfaceProxy() {
291+
void spr14322AnnotationOnInterfaceWithInterfaceProxy() {
291292
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14322ConfigA.class);
292293
TransactionalTestInterface bean = ctx.getBean(TransactionalTestInterface.class);
293294
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
@@ -302,7 +303,7 @@ void spr14322FindsOnInterfaceWithInterfaceProxy() {
302303
}
303304

304305
@Test
305-
void spr14322FindsOnInterfaceWithCglibProxy() {
306+
void spr14322AnnotationOnInterfaceWithCglibProxy() {
306307
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14322ConfigB.class);
307308
TransactionalTestInterface bean = ctx.getBean(TransactionalTestInterface.class);
308309
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);

0 commit comments

Comments
 (0)