File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
spring-context/src/main/java/org/springframework/scheduling/concurrent
spring-tx/src/test/java/org/springframework/transaction/annotation Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 27
27
import java .util .concurrent .ScheduledThreadPoolExecutor ;
28
28
import java .util .concurrent .TimeUnit ;
29
29
30
+ import org .apache .commons .logging .LogFactory ;
31
+
30
32
import org .springframework .context .ApplicationContext ;
31
33
import org .springframework .context .ApplicationContextAware ;
32
34
import org .springframework .context .ApplicationListener ;
@@ -191,12 +193,21 @@ protected void doExecute(Runnable task) {
191
193
}
192
194
}
193
195
196
+ private Runnable taskOnSchedulerThread (Runnable task ) {
197
+ return new DelegatingErrorHandlingRunnable (task , TaskUtils .getDefaultErrorHandler (true ));
198
+ }
199
+
194
200
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 ));
196
202
}
197
203
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
+ }
200
211
}
201
212
202
213
Original file line number Diff line number Diff line change @@ -286,8 +286,9 @@ void gh24291TransactionManagerViaQualifierAnnotation() {
286
286
287
287
ctx .close ();
288
288
}
289
+
289
290
@ Test
290
- void spr14322FindsOnInterfaceWithInterfaceProxy () {
291
+ void spr14322AnnotationOnInterfaceWithInterfaceProxy () {
291
292
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (Spr14322ConfigA .class );
292
293
TransactionalTestInterface bean = ctx .getBean (TransactionalTestInterface .class );
293
294
CallCountingTransactionManager txManager = ctx .getBean (CallCountingTransactionManager .class );
@@ -302,7 +303,7 @@ void spr14322FindsOnInterfaceWithInterfaceProxy() {
302
303
}
303
304
304
305
@ Test
305
- void spr14322FindsOnInterfaceWithCglibProxy () {
306
+ void spr14322AnnotationOnInterfaceWithCglibProxy () {
306
307
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (Spr14322ConfigB .class );
307
308
TransactionalTestInterface bean = ctx .getBean (TransactionalTestInterface .class );
308
309
CallCountingTransactionManager txManager = ctx .getBean (CallCountingTransactionManager .class );
You can’t perform that action at this time.
0 commit comments