private void terminateTaskMgr(){
  if (discoveryWakeupMgr != null) {
    discoveryWakeupMgr.stop();
    discoveryWakeupMgr.cancelAll();
  }
  if (discoveryTaskMgr != null) {
    List pendingTasks=discoveryTaskMgr.getPending();
    for (int i=0; i < pendingTasks.size(); i++) {
      RetryTask pendingTask=(RetryTask)pendingTasks.get(i);
      pendingTask.cancel();
      discoveryTaskMgr.remove(pendingTask);
    }
    discoveryTaskMgr.terminate();
    discoveryTaskMgr=null;
    discoveryWakeupMgr=null;
  }
}

private void terminateTaskMgr ( ) { if ( discoveryWakeupMgr != null ) { discoveryWakeupMgr . stop ( ) ; discoveryWakeupMgr . cancelAll ( ) ; } if ( discoveryTaskMgr != null ) { List pendingTasks = discoveryTaskMgr . getPending ( ) ; for ( int i = 0 ; i < pendingTasks . size ( ) ; i ++ ) { RetryTask pendingTask = ( RetryTask ) pendingTasks . get ( i ) ; pendingTask . cancel ( ) ; discoveryTaskMgr . remove ( pendingTask ) ; } discoveryTaskMgr . terminate ( ) ; discoveryTaskMgr = null ; discoveryWakeupMgr = null ; } }
convenience method that removes all pending and active tasks from the taskmanager , and removes all pending tasks from the wakeupmanager .
