AsyncExecutionAspectSupport.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Determine the specific executor to use when executing the given method.
 * @return the executor to use (or {@code null}, but just if no default executor has been set)
 */
protected AsyncTaskExecutor determineAsyncExecutor(Method method) {
    AsyncTaskExecutor executor = this.executors.get(method);
    if (executor == null) {
        Executor executorToUse = this.defaultExecutor;
        String qualifier = getExecutorQualifier(method);
        if (StringUtils.hasLength(qualifier)) {
            Assert.notNull(this.beanFactory, "BeanFactory must be set on " + getClass().getSimpleName() +
                    " to access qualified executor '" + qualifier + "'");
            executorToUse = BeanFactoryAnnotationUtils.qualifiedBeanOfType(
                    this.beanFactory, Executor.class, qualifier);
        }
        else if (executorToUse == null) {
            return null;
        }
        executor = (executorToUse instanceof AsyncTaskExecutor ?
                (AsyncTaskExecutor) executorToUse : new TaskExecutorAdapter(executorToUse));
        this.executors.put(method, executor);
    }
    return executor;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号