Package com.webobjects.appserver

Examples of com.webobjects.appserver.WOTimer


            // That timer will kick off a repeating, hourly, timer for _checkSchedules every hour on the hour
            NSTimestamp fireDate = calculateNearestHour();

            //NSTimestamp fireDate, long ti, Object aTarget, String aSelectorName, Object userInfo, Class userInfoClass, boolean repeat
            aScheduleTimer = new WOTimer(fireDate, (60 * 60 * 1000), this, "_checkSchedules", null, null, true);
            aScheduleTimer.schedule();

            // This is the regular timer that should do autorecovery
            anAutoRecoverTimer = WOTimer.scheduledTimer(aConfig.autoRecoverInterval(), this, "_checkAutoRecover", null, null, true);

View Full Code Here


        log.info("Instance will live " + timeToLive + " seconds.");
        NSLog.out.appendln("Instance will live " + timeToLive + " seconds.");
        // add a fudge factor of around 10 minutes
        timeToLive += Math.random() * 600;
        NSTimestamp exitDate = (new NSTimestamp()).timestampByAddingGregorianUnits(0, 0, 0, 0, 0, timeToLive);
        WOTimer t = new WOTimer(exitDate, 0, this, "killInstance", null, null, false);
        t.schedule();
      }
      int timeToDie = ERXProperties.intForKey("ERTimeToDie");
      if (timeToDie > 0) {
        log.info("Instance will not live past " + timeToDie + ":00.");
        NSLog.out.appendln("Instance will not live past " + timeToDie + ":00.");
        NSTimestamp now = new NSTimestamp();
        int s = (timeToDie - ERXTimestampUtilities.hourOfDay(now)) * 3600 - ERXTimestampUtilities.minuteOfHour(now) * 60;
        if (s < 0)
          s += 24 * 3600; // how many seconds to the deadline
 
        // deliberately randomize this so that not all instances restart at
        // the same time
        // adding up to 1 hour
        s += (Math.random() * 3600);
 
        NSTimestamp stopDate = now.timestampByAddingGregorianUnits(0, 0, 0, 0, 0, s);
        WOTimer t = new WOTimer(stopDate, 0, this, "startRefusingSessions", null, null, false);
        t.schedule();
      }
      super.run();
    }
    catch (RuntimeException t) {
      if (ERXApplication._wasMainInvoked) {
View Full Code Here

    if (install) {
      int timeToKill = ERXProperties.intForKey("ERTimeToKill");
      if (timeToKill > 0) {
        log.warn("Registering kill timer in " + timeToKill + "seconds");
        NSTimestamp exitDate = (new NSTimestamp()).timestampByAddingGregorianUnits(0, 0, 0, 0, 0, timeToKill);
        _killTimer = new WOTimer(exitDate, 0, this, "killInstance", null, null, false);
        _killTimer.schedule();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.webobjects.appserver.WOTimer

Copyright © 2018 www.massapicom. 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.