org.springframework.scheduling.annotation.Async.value()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.springframework.scheduling.annotation.Async.value()方法的一些代码示例,展示了Async.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Async.value()方法的具体详情如下:
包路径:org.springframework.scheduling.annotation.Async
类名称:Async
方法名:value

Async.value介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return the qualifier or bean name of the executor to be used when executing the
 * given method, specified via {@link Async#value} at the method or declaring
 * class level. If {@code @Async} is specified at both the method and class level, the
 * method's {@code #value} takes precedence (even if empty string, indicating that
 * the default executor should be used preferentially).
 * @param method the method to inspect for executor qualifier metadata
 * @return the qualifier if specified, otherwise empty string indicating that the
 * {@linkplain #setExecutor(Executor) default executor} should be used
 * @see #determineAsyncExecutor(Method)
 */
@Override
@Nullable
protected String getExecutorQualifier(Method method) {
  // Maintainer's note: changes made here should also be made in
  // AnnotationAsyncExecutionAspect#getExecutorQualifier
  Async async = AnnotatedElementUtils.findMergedAnnotation(method, Async.class);
  if (async == null) {
    async = AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), Async.class);
  }
  return (async != null ? async.value() : null);
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Return the qualifier or bean name of the executor to be used when executing the
 * given method, specified via {@link Async#value} at the method or declaring
 * class level. If {@code @Async} is specified at both the method and class level, the
 * method's {@code #value} takes precedence (even if empty string, indicating that
 * the default executor should be used preferentially).
 * @param method the method to inspect for executor qualifier metadata
 * @return the qualifier if specified, otherwise empty string indicating that the
 * {@linkplain #setExecutor(Executor) default executor} should be used
 * @see #determineAsyncExecutor(Method)
 */
@Override
@Nullable
protected String getExecutorQualifier(Method method) {
  // Maintainer's note: changes made here should also be made in
  // AnnotationAsyncExecutionAspect#getExecutorQualifier
  Async async = AnnotatedElementUtils.findMergedAnnotation(method, Async.class);
  if (async == null) {
    async = AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), Async.class);
  }
  return (async != null ? async.value() : null);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Return the qualifier or bean name of the executor to be used when executing the
 * given method, specified via {@link Async#value} at the method or declaring
 * class level. If {@code @Async} is specified at both the method and class level, the
 * method's {@code #value} takes precedence (even if empty string, indicating that
 * the default executor should be used preferentially).
 * @param method the method to inspect for executor qualifier metadata
 * @return the qualifier if specified, otherwise empty string indicating that the
 * {@linkplain #setExecutor(Executor) default executor} should be used
 * @see #determineAsyncExecutor(Method)
 */
@Override
@Nullable
protected String getExecutorQualifier(Method method) {
  // Maintainer's note: changes made here should also be made in
  // AnnotationAsyncExecutionAspect#getExecutorQualifier
  Async async = AnnotatedElementUtils.findMergedAnnotation(method, Async.class);
  if (async == null) {
    async = AnnotatedElementUtils.findMergedAnnotation(method.getDeclaringClass(), Async.class);
  }
  return (async != null ? async.value() : null);
}

相关文章

微信公众号

最新文章

更多