Examples of scheduleAtFixedRate()


Examples of java.util.Timer.scheduleAtFixedRate()

        Timer result = new Timer(endpoint.getTimerName(), endpoint.isDaemon());
        if (endpoint.isFixedRate()) {
            if (endpoint.getTime() != null) {
                result.scheduleAtFixedRate(task, endpoint.getTime(), endpoint.getPeriod());
            } else {
                result.scheduleAtFixedRate(task, endpoint.getDelay(), endpoint.getPeriod());
            }
        } else {
            if (endpoint.getTime() != null) {
                if (endpoint.getPeriod() >= 0) {
                    result.schedule(task, endpoint.getTime(), endpoint.getPeriod());
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      if (file.exists())
      {
         file.delete();
      }
      final Timer timer = new Timer("HornetQ Server Shutdown Timer", true);
      timer.scheduleAtFixedRate(new TimerTask()
      {
         @Override
         public void run()
         {
            if (file.exists())
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      t = new Timer();
      TimerTestTask testTask = new TimerTestTask();
      t.cancel();
      boolean exception = false;
      try {
        t.scheduleAtFixedRate(testTask, 100, 100);
      } catch (IllegalStateException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate after Timer.cancel() should throw exception",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // negative
      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
      try {
        t.scheduleAtFixedRate(testTask, -100, 100);
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate with negative delay should throw IllegalArgumentException",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // negative
      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
      try {
        t.scheduleAtFixedRate(testTask, 100, -100);
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate with negative period should throw IllegalArgumentException",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      t.cancel();

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

Examples of java.util.Timer.scheduleAtFixedRate()

      // Ensure multiple tasks are run
      t = new Timer();
      SlowThenFastTask slowThenFastTask = new SlowThenFastTask();

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

Examples of java.util.Timer.scheduleAtFixedRate()

      TimerTestTask testTask = new TimerTestTask();
      t.cancel();
      boolean exception = false;
      Date d = new Date(System.currentTimeMillis() + 100);
      try {
        t.scheduleAtFixedRate(testTask, d, 100);
      } catch (IllegalStateException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate after Timer.cancel() should throw exception",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
      d = new Date(-100);
      try {
        t.scheduleAtFixedRate(testTask, d, 100);
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate with negative Date should throw IllegalArgumentException",
View Full Code Here

Examples of java.util.Timer.scheduleAtFixedRate()

      // negative
      t = new Timer();
      testTask = new TimerTestTask();
      exception = false;
      try {
        t.scheduleAtFixedRate(testTask, d, -100);
      } catch (IllegalArgumentException e) {
        exception = true;
      }
      assertTrue(
          "scheduleAtFixedRate with negative period should throw IllegalArgumentException",
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.