synchronized void execute ( File root , Runnable task ) { if ( executors == null ) { throw new RuntimeException ( "AsyncDiskService is already shutdown" ) ; } ThreadPoolExecutor executor = executors . get ( root ) ; if ( executor == null ) { throw new RuntimeException ( "Cannot find root " + root + " for execution of task " + task ) ; } else { executor . execute ( task ) ; } }
Execute the task sometime in the future using ThreadPools .