Package java.util

Examples of java.util.Timer.scheduleAtFixedRate()


      public void run() {
        scan();
      }
    };
    Timer t = new Timer();
    t.scheduleAtFixedRate(task, 0, INTERVAL);
  }

  private File cleanFile() {
    return new File(PMS.getConfiguration().getDataFile("UMS.tmpmgr"));
  }
View Full Code Here


        //eImgRss.setText("<img  height='70' width='70' src='" + rssHeader.getRssHeaderImage().getImageUrl() + "'></img>");
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

        Timer timer = new Timer();
     
     timer.scheduleAtFixedRate(new TimerTask() {

            @Override
            public void run() {
               i++;
               if(i==10)i=0;
View Full Code Here

        // we schedule a publishing of all counters for every minute.
        long currentMs = System.currentTimeMillis();
        long delay = (60 * 1000) - (currentMs % (60 * 1000));
        Timer refDataDownloadTimer = new Timer(true);
        refDataDownloadTimer.scheduleAtFixedRate(refDataDownloadTask, (long) (1 * delay), (long) (1 * 60 * 1000));

    }

    public SNMPReporter() throws UnknownHostException, IOException {
        this(InetAddress.getLocalHost().getHostAddress(), 65000);
View Full Code Here

    public void init() {
        state = States.INIT;
        Timer timer = new Timer("Priority Timer", false);
        long delayMs = delay * (int) (1000L / delay);
        timer.scheduleAtFixedRate(this, delayMs, delayMs);
    }

    public void start() {
        if (state == States.NONE) {
            throw new IllegalStateException("Timer should have been initialized first");
View Full Code Here

            resourceConfig.registerInstances(new ContainerLifecycleListener() {
                @Override
                public void onStartup(final Container container) {
                    App.container = container;
                    final Timer t = new Timer(true);
                    t.scheduleAtFixedRate(new FileCheckTask(0), 0, REFRESH_PERIOD_MS);
                }

                @Override
                public void onReload(final Container container) {
                    System.out.println("Application has been reloaded!");
View Full Code Here

    /**
     * Update checker scheduler - fires every week
     */
    private Timer scheduleUpdateCheck() {
        Timer rval = new Timer(true);
        rval.scheduleAtFixedRate(new UpdateChecker(), 1000, 7 * 24 * 60 * 60 * 1000L);
        return rval;
    }

    /**
     * Register the scheduler in the local MBeanServer.
View Full Code Here

      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

      // 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

      // 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

      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

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.