Package java.util

Examples of java.util.Timer.scheduleAtFixedRate()


        if(perfmonIntervalnMills == -1 || !LOG.isInfoEnabled()) {
            return;
        }
        PerfmonTask task = new PerfmonTask();
        Timer timer = new Timer(SRV_NAME, true);
        timer.scheduleAtFixedRate(task, 1000, perfmonIntervalnMills);
        this._timer = timer;
        this._status = Status.started;
    }

    public void stop() throws ServiceException {
View Full Code Here


        return this.activeMembers;
    }

    public void startApplicationMembershipTimer(){
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new MemberActivatorTask(), 1000, 500);
    }

    /**
     * The task which checks whther inactive members have become available again
     */
 
View Full Code Here

                lng.set(System.currentTimeMillis());
            }
        });

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

            @Override
            public void run() {

                // Check how old the last event is. If it's too old, warn
View Full Code Here

                listenerThread.start();

                Broadcaster broadcaster = new Broadcaster();

                Timer timer = new Timer("MulticastDiscovery: Broadcaster", true);
                timer.scheduleAtFixedRate(broadcaster, 0, heartRate);
            }
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

        };

        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) {
View Full Code Here

        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

      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

      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

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.