@ Override public final boolean cancel ( boolean mayInterruptIfRunning ) { boolean did = false ; synchronized ( this ) { // Install the answer under lock if ( ! isCancelled ( ) ) { did = true ; // Did cancel (was not cancelled already) _target . taskRemove ( _tasknum ) ; _target = null ; // Flag as canceled // UDPTimeOutThread.PENDING.remove(this); } notifyAll ( ) ; // notify in any case } return did ; }
Attempt to cancel job