Package java.util.concurrent

Examples of java.util.concurrent.ScheduledFuture.cancel()


    System.out.println("After this line you will see d2 client will start logging warning"
                           + " message because server 2,4,6's latencies are higher than" +
                           "the threshold (high water mark).");
    System.out.println("===========================================================");
    System.in.read();
    task.cancel(false);

    task = executorService.scheduleAtFixedRate(new Runnable()
    {
      @Override
      public void run ()
View Full Code Here


    System.out.println("=========================================================\n\n\n");
    System.out.println("Now all servers are healthy. Traffic for 'member' " +
                           "will be balanced between profile service 1,2,3,4,5,6.");
    System.out.println("Press enter to shut down\n\n");
    System.in.read();
    task.cancel(false);

    System.out.println("Shutting down...");
    shutdown(d2Client, executorService, clientShutdownTimeout);
  }
View Full Code Here

    System.out.println("Press enter to shutdown");
    System.out.println("===========================================================\n\n");
    System.in.read();
    normalTask.cancel(false);
    overrideTask.cancel(false);

    System.out.println("Shutting down... please wait 15 seconds.");
    shutdown(normalD2Client, overrideD2Client, executorService, clientShutdownTimeout);
  }
View Full Code Here

    }, 0, 1000, TimeUnit.MILLISECONDS);

    System.out.println("Press enter to shutdown");
    System.out.println("===========================================================\n\n");
    System.in.read();
    task.cancel(false);

    System.out.println("Shutting down...");
    shutdown(d2Client, executorService, clientShutdownTimeout);
  }
View Full Code Here

      }
    }, 0, rate, TimeUnit.MILLISECONDS);

    System.out.println("Press enter to stop D2 client...");
    System.in.read();
    task.cancel(false);
    System.out.println("Shutting down...");
    shutdown(d2Client, executorService, clientShutdownTimeout);
  }

  private static void startClient(final D2Client d2Client,
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testReplQueueImpl() {
      ReplicationQueueImpl rqi = new ReplicationQueueImpl();
      ScheduledFuture sf = mock(ScheduledFuture.class);
      when(sf.cancel(eq(true))).thenReturn(true);

      ScheduledExecutorService ses = mock(ScheduledExecutorService.class);
      when(ses.scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class)))
         .thenReturn(sf);
View Full Code Here

        if (entries.isEmpty()) {
            scheduledEntries.remove(second);

            ScheduledFuture removed = scheduledTaskMap.remove(second);
            if (removed != null) {
                removed.cancel(false);
            }
        }
        return result;
    }
View Full Code Here

     * @param monitor
     */
    public static void unRegister(Monitor monitor) {
        ScheduledFuture future = register.remove(monitor);
        if (future != null) {
            future.cancel(true);// 打断
        }
    }
}
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testReplQueueImpl() {
      ReplicationQueueImpl rqi = new ReplicationQueueImpl();
      ScheduledFuture sf = mock(ScheduledFuture.class);
      when(sf.cancel(eq(true))).thenReturn(true);

      ScheduledExecutorService ses = mock(ScheduledExecutorService.class);
      when(ses.scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class)))
         .thenReturn(sf);
View Full Code Here

      if (instance != null)
      {
         ScheduledFuture f = instance.shutdown.getAndSet(null);
         if (f != null)
         {
            f.cancel(false);
         }
      }
      else
      {
         instance = new SharedNioEventLoopGroup(numThreads, new HornetQThreadFactory("HornetQ-client-netty-threads", true, getThisClassLoader()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.