Browse Source

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
pull/32386/head
Juergen Hoeller 2 years ago
parent
commit
13221ac0ef
  1. 17
      spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java
  2. 5
      spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java

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

@ -27,6 +27,8 @@ import java.util.concurrent.ScheduledFuture; @@ -27,6 +27,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationListener;
@ -191,12 +193,21 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements @@ -191,12 +193,21 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
}
}
private Runnable taskOnSchedulerThread(Runnable task) {
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true));
}
private Runnable scheduledTask(Runnable task) {
return () -> execute(new DelegatingErrorHandlingRunnable(task, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
return () -> execute(new DelegatingErrorHandlingRunnable(task, this::shutdownAwareErrorHandler));
}
private Runnable taskOnSchedulerThread(Runnable task) {
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true));
private void shutdownAwareErrorHandler(Throwable ex) {
if (this.scheduledExecutor.isTerminated()) {
LogFactory.getLog(getClass()).debug("Ignoring scheduled task exception after shutdown", ex);
}
else {
TaskUtils.getDefaultErrorHandler(true).handleError(ex);
}
}

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

@ -286,8 +286,9 @@ class EnableTransactionManagementTests { @@ -286,8 +286,9 @@ class EnableTransactionManagementTests {
ctx.close();
}
@Test
void spr14322FindsOnInterfaceWithInterfaceProxy() {
void spr14322AnnotationOnInterfaceWithInterfaceProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14322ConfigA.class);
TransactionalTestInterface bean = ctx.getBean(TransactionalTestInterface.class);
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
@ -302,7 +303,7 @@ class EnableTransactionManagementTests { @@ -302,7 +303,7 @@ class EnableTransactionManagementTests {
}
@Test
void spr14322FindsOnInterfaceWithCglibProxy() {
void spr14322AnnotationOnInterfaceWithCglibProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Spr14322ConfigB.class);
TransactionalTestInterface bean = ctx.getBean(TransactionalTestInterface.class);
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);

Loading…
Cancel
Save