【发布时间】:2010-07-23 23:46:39
【问题描述】:
我想使用局部变量注解来做更好的 AOP。一种想法是通过使用注解的代理来实现 Future
@NonBlocking ExpensiveObject exp = new ExpensiveObject();
//returns immediately, but has threaded out instantiation of the ExpensiveObject.
exp.doStuff();
//okay, now it blocks until it's finished instantiating and then executes #doStuff
我能否以某种方式让 AspectJ 生病并使用局部变量注释来完成我想要的工作?我知道其他线程表明 Java 并不真正支持它们,但它会很神奇。我真的不想传递 Future 并破坏封装。
【问题讨论】:
标签: java annotations aop aspectj