Examples of scheduleAtFixedRate()


Examples of java.util.Timer.scheduleAtFixedRate()

      // Ensure a Timer throws an NullPointerException if date is Null
      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
      try {
        t.scheduleAtFixedRate(testTask, null, 100);
      } catch (NullPointerException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate with null date should throw NullPointerException",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // Ensure proper sequence of exceptions
      t = new Timer();
      exception = false;
      d = new Date(-100);
      try {
        t.scheduleAtFixedRate(null, d, 10);
      } catch (NullPointerException e) {
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // Ensure proper sequence of exceptions
      t = new Timer();
      exception = false;
      try {
        t.scheduleAtFixedRate(null, null, -10);
      } catch (NullPointerException e) {
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // Ensure a task is run at least twice
      t = new Timer();
      testTask = new TimerTestTask();
      d = new Date(System.currentTimeMillis() + 100);
      t.scheduleAtFixedRate(testTask, d, 100);
      try {
        Thread.sleep(400);
      } catch (InterruptedException e) {
      }
      assertTrue(
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      t = new Timer();
      SlowThenFastTask slowThenFastTask = new SlowThenFastTask();
      d = new Date(System.currentTimeMillis() + 100);

      // at least 9 times even when asleep
      t.scheduleAtFixedRate(slowThenFastTask, d, 100);
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
      }
      long lastDelta = slowThenFastTask.lastDelta();
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

                listenerThread.start();

                Broadcaster broadcaster = new Broadcaster();

                Timer timer = new Timer("MulticastDiscovery: Broadcaster", true);
                timer.scheduleAtFixedRate(broadcaster, 0, heartRate);
            }
    }

    private void newSocket() throws IOException {
        InetAddress inetAddress = InetAddress.getByName(host);
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

        localTracker = getLocalNodeServiceTracker();

        NodeServiceHandlerThread nodeServiceHandlerThread = new NodeServiceHandlerThread();
        Timer timer = new Timer("WADIDiscoveryAgent: checkRemoteService", true);

        timer.scheduleAtFixedRate(nodeServiceHandlerThread, 0, heartRate);

        if (started.compareAndSet(false, true)) {

            Thread listenerThread = new Thread(listener);
            listenerThread.setName("WADIDiscoveryAgent: ListenerThread");
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

  @Override
  public void start(int delay) {
    synchronized (this) {
      if (!started) {
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {

          @Override
          public void run() {
            for (DataListener turnListener : getListeners()) {
              if (turnListener instanceof TurnListener) {
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

    final String className = words[0];
   
    // Set a timer running that will update reporter on a period.
    Timer t = new Timer(false);
   
    t.scheduleAtFixedRate(new TimerTask()
    {
      @Override
      public void run() {  
          reporter.setStatus("Running " + className);   
      }
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      if (period == -1) {
        new MetricsTimerTask(plugin).run();
      } else {
        Thread.sleep(until - now);
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new MetricsTimerTask(plugin), 0,
            period * 1000);
      }
    } catch (Exception ex) {
      log.debug(ExceptionUtil.getStackTrace(ex));
    }
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.