public boolean cancel ( final boolean mayInterruptIfRunning , final long timeout , final TimeUnit unit ) throws TimeoutException { return cancel ( mayInterruptIfRunning , Optional . of ( timeout ) , Optional . of ( unit ) ) ; }
Sends a cancel signal and blocks and waits until the task is cancelled completed or failed or if the timeout has expired .