コード例 #1
0
 static {
   // initialize the thread pool
   ThreadPoolDefinition def = new ThreadPoolDefinition();
   def.setBounded(true);
   def.setMaxSize(10);
   def.setMinSize(5);
   def.setInitSize(5);
   def.setKeepAliveTime(6000);
   def.setWaitWhenBlocked(true);
   AsynchronousManager.getInstance().initialize(def);
 }
コード例 #2
0
 public Object execute(final JoinPoint joinPoint) throws Throwable {
   AsynchronousManager.getInstance()
       .execute(
           new Runnable() {
             public void run() {
               try {
                 // invoke the intercepted method
                 joinPoint
                     .proceedInNewThread(); // caution: needs to be proceedInNewThread() and not
                 // proceed()
               } catch (Throwable e) {
                 throw new WrappedRuntimeException(e);
               }
             }
           });
   return null;
 }