private void scheduleFlushTask()
   {
      // cancel task
      if (flushTask != null)
      {
         flushTask.cancel();
      }
      // clear canceled tasks
      FLUSH_TIMER.purge();
      // new flush task, cause canceled can't be re-used
      flushTask = new TimerTask()
      {
         @Override
         public void run()
         {
            // check if volatile index should be flushed
            checkFlush();
         }
      };
      FLUSH_TIMER.schedule(flushTask, 0, 1000);
      lastFlushTime = System.currentTimeMillis();
      lastFileSystemFlushTime = System.currentTimeMillis();
   }
private void scheduleFlushTask ( ) { if ( flushTask != null ) { flushTask . cancel ( ) ; } FLUSH_TIMER . purge ( ) ; flushTask = new TimerTask ( ) { @ Override public void run ( ) { checkFlush ( ) ; } } ; FLUSH_TIMER . schedule ( flushTask , 0 , 1000 ) ; lastFlushTime = System . currentTimeMillis ( ) ; lastFileSystemFlushTime = System . currentTimeMillis ( ) ; }
Cancel flush task and add new one