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;
    }
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.

@param <T>          the type parameter
@param callableWork the callable work
@param timeoutInSec the timeout in sec
@return the future