public static < T > Future < T > run ( Callable < T > callableWork , long timeoutInSec ) { final ExecutorService threadPool = Executors . newFixedThreadPool ( 2 ) ; Future < T > future = threadPool . submit ( callableWork ) ; afterTimeout ( timeoutInSec , threadPool , future ) ; return future ; }
Run future .