Skip to content

Commit

Permalink
Added test for custom async annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Oct 31, 2012
1 parent a6bcda2 commit 6d6eaf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -42,7 +42,7 @@
* @see AnnotationAsyncExecutionInterceptor
* @see AsyncAnnotationAdvisor
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Async {
Expand Down
Expand Up @@ -16,6 +16,8 @@

package org.springframework.scheduling.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.Future;

import org.junit.Test;
Expand Down Expand Up @@ -200,7 +202,7 @@ public void doSomething(int i) {
assertTrue(Thread.currentThread().getName().startsWith("e1-"));
}

@Async("e2")
@MyAsync
public Future<String> returnSomething(int i) {
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
assertTrue(Thread.currentThread().getName().startsWith("e2-"));
Expand All @@ -215,6 +217,12 @@ public Future<String> returnSomething2(int i) {
}


@Async("e2")
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAsync {
}


@Async
public static class AsyncClassBean {

Expand Down

0 comments on commit 6d6eaf8

Please sign in to comment.