FileDocCategorySizeDatePackage
ThreadPoolExecutor.javaAPI DocJBoss 4.2.12623Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.asynch

ThreadPoolExecutor

public class ThreadPoolExecutor extends Object implements ExecutorAbstraction
Use a global thread pool to execute asynch tasks
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
private static EDU.oswego.cs.dl.util.concurrent.Executor
executor
Constructors Summary
Methods Summary
public RemotableFutureexecute(org.jboss.aop.joinpoint.MethodInvocation invocation)

      final MethodInvocation copy = (MethodInvocation) invocation.copy();
      final ClassLoader cl = Thread.currentThread().getContextClassLoader();
      
      FutureResult result = new FutureResult();
      Runnable command = result.setter(new Callable()
      {
         public Object call() throws Exception
         {
            try
            {
               Thread.currentThread().setContextClassLoader(cl);
               return copy.invokeNext();
            }
            catch (Throwable throwable)
            {
               if (throwable instanceof Exception)
               {
                  throw ((Exception) throwable);
               }
               else
                  throw new Exception(throwable);
            }
         }
      });
      executor.execute(command);

      return new FutureImpl(result);
   
public voidsetAdvisor(org.jboss.aop.Advisor advisor)