private boolean scheduleNext(){
  final String tag="Scheduled session[" + taskid + "]";
  try {
    LOG.finer(tag + ": scheduling next session for " + delayBeforeNext+ "ms");
    if (cancelled || !notifyStateChange(SCHEDULED,"scan-scheduled")) {
      LOG.finer(tag + " stopped: do not reschedule");
      return false;
    }
    final SessionTask nextTask=new SessionTask(delayBeforeNext);
    if (!scheduleSession(nextTask,delayBeforeNext))     return false;
    LOG.finer(tag + ": next session successfully scheduled");
  }
 catch (  Exception x) {
    if (LOG.isLoggable(Level.FINEST)) {
      LOG.log(Level.FINEST,tag + " failed to schedule next session: " + x,x);
    }
 else     if (LOG.isLoggable(Level.FINE)) {
      LOG.fine(tag + " failed to schedule next session: " + x);
    }
  }
  return true;
}

private boolean scheduleNext ( ) { final String tag = "Scheduled session[" + taskid + "]" ; try { LOG . finer ( tag + ": scheduling next session for " + delayBeforeNext + "ms" ) ; if ( cancelled || ! notifyStateChange ( SCHEDULED , "scan-scheduled" ) ) { LOG . finer ( tag + " stopped: do not reschedule" ) ; return false ; } final SessionTask nextTask = new SessionTask ( delayBeforeNext ) ; if ( ! scheduleSession ( nextTask , delayBeforeNext ) ) return false ; LOG . finer ( tag + ": next session successfully scheduled" ) ; } catch ( Exception x ) { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , tag + " failed to schedule next session: " + x , x ) ; } else if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( tag + " failed to schedule next session: " + x ) ; } } return true ; }
schedule an identical task for next iteration .
