public < T extends Runnable > T executeAsyncTimed ( T runnable , long inMs ) { final Runnable theRunnable = runnable ; // This implementation is not really suitable for now as the timer uses its own thread // The TaskQueue itself should be able in the future to handle this without using a new thread Timer timer = new Timer ( ) ; timer . schedule ( new TimerTask ( ) { @ Override public void run ( ) { TaskQueue . this . executeAsync ( theRunnable ) ; } } , inMs ) ; return runnable ; }
Add a Task to the queue . The Task will be executed after inMs milliseconds .