src/main/java/org/jboss/util/timeout/TimeoutFactory.java
private void doWork()
   {
      while (cancelled.get() == false)
      {
         TimeoutExt work = queue.take();
         // Do work, if any
         if (work != null)
         {
            // Wrap the TimeoutExt with a runnable that invokes the target callback
            TimeoutWorker worker = new TimeoutWorker(work);
            try
            {
               threadPool.run(worker);
            }
            catch (Throwable t)
            {
               // protect the worker thread from pool enqueue errors
               ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
            }
            synchronized (work)
            {
               work.done();
            }            
         }
      }
      
      // TimeoutFactory was cancelled
      queue.cancel();
   }
private void doWork()
   {
      while (cancelled.get() == false)
      {
         TimeoutExt work = queue.take();
         // Do work, if any
         if (work != null)
         {
            // Wrap the TimeoutExt with a runnable that invokes the target callback
            TimeoutWorker worker = new TimeoutWorker(work);
            try
            {
               threadPool.run(worker);
            }
            catch (Throwable t)
            {
               // protect the worker thread from pool enqueue errors
               ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
            }
            synchronized (work)
            {
               work.done();
            }            
         }
      }
      
      // TimeoutFactory was cancelled
      queue.cancel();
   }
private void doWork ( ) { while ( cancelled . get ( ) == false ) { TimeoutExt work = queue . take ( ) ; // Do work, if any if ( work != null ) { // Wrap the TimeoutExt with a runnable that invokes the target callback TimeoutWorker worker = new TimeoutWorker ( work ) ; try { threadPool . run ( worker ) ; } catch ( Throwable t ) { // protect the worker thread from pool enqueue errors ThrowableHandler . add ( ThrowableHandler . Type . ERROR , t ) ; } synchronized ( work ) { work . done ( ) ; } } } // TimeoutFactory was cancelled queue . cancel ( ) ; }
Timeout worker method.
Timeout worker method .