Browse Source

Clear cached executors in setBeanFactory (for reused AspectJ aspect)

Closes gh-28201
pull/31663/head
Juergen Hoeller 2 years ago
parent
commit
121e3540cc
  1. 8
      spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java

8
spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -73,8 +73,6 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { @@ -73,8 +73,6 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
protected final Log logger = LogFactory.getLog(getClass());
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<>(16);
private SingletonSupplier<Executor> defaultExecutor;
private SingletonSupplier<AsyncUncaughtExceptionHandler> exceptionHandler;
@ -85,6 +83,9 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { @@ -85,6 +83,9 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
@Nullable
private StringValueResolver embeddedValueResolver;
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<>(16);
/**
* Create a new instance with a default {@link AsyncUncaughtExceptionHandler}.
* @param defaultExecutor the {@code Executor} (typically a Spring {@code AsyncTaskExecutor}
@ -157,6 +158,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { @@ -157,6 +158,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
if (beanFactory instanceof ConfigurableBeanFactory configurableBeanFactory) {
this.embeddedValueResolver = new EmbeddedValueResolver(configurableBeanFactory);
}
this.executors.clear();
}

Loading…
Cancel
Save