public static Future doInBackground ( Callable callable ) { final ExecutorService executor = Executors . newSingleThreadExecutor ( ) ; Future future = executor . submit ( callable ) ; if ( executor . isTerminated ( ) ) { executor . shutdown ( ) ; } return future ; }
Submits a Callable object and returns a Future ready to use .