FileDocCategorySizeDatePackage
TimedCallableImpl.javaAPI DocJBoss 4.2.12559Fri Jul 13 21:02:30 BST 2007org.jboss.aspects.asynchronous.concurrent

TimedCallableImpl

public class TimedCallableImpl extends EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser implements org.jboss.aspects.asynchronous.ProcessingTime, EDU.oswego.cs.dl.util.concurrent.Callable
author
{Claude Hussenet Independent Consultant}.
version
$Revision: 57186 $

Fields Summary
private final AdapterTask
function
private final long
millis
private long
endingTime
private long
startingTime
Constructors Summary
public TimedCallableImpl(AdapterTask function, long millis)



       
   

      this.function = function;

      this.millis = millis;

   
Methods Summary
public java.lang.Objectcall()


      FutureResult result = new FutureResult();


      Thread thread = getThreadFactory().newThread(result.setter(function));

      thread.start();

      try
      {

         startingTime = System.currentTimeMillis();

         Object obj = result.timedGet(millis);

         endingTime = System.currentTimeMillis();

         return obj;

      }
      catch (InterruptedException ex)
      {

         endingTime = System.currentTimeMillis();

         function.cleanup();

         thread.interrupt();

         throw ex;

      }

   
public longgetEndingTime()


      return endingTime;

   
public longgetStartingTime()


      return startingTime;