Code example for ScheduledFuture

Methods: cancel

0
                                                TimeUnit.SECONDS);
  } 
 
  private void cancel() { 
    if (inactivityFuture != null) {
      inactivityFuture.cancel(true);
      inactivityFuture = null;
    } 
  } 
 
  void shutdown() { 
    cancel(); 
    inactivityTimer.shutdown();
  } 
 
  private static final class DaemonThreadFactory implements ThreadFactory {
    public Thread newThread(Runnable runnable) {
      Thread thread = new Thread(runnable);
      thread.setDaemon(true);
      return thread;
    }