public void unscheduleTask ( ) { if ( unschedule . compareAndSet ( false , true ) ) { scheduledFuture . cancel ( false ) ; scheduledFuture = null ; } }
Unschedule task if active and cancel thread to inform it must be interrupted in a proper way .