Package java.util

Examples of java.util.Timer.schedule()


        int delaySecs = GlobalProperties.getInt("ebean.cacheWarmingDelay", 30);
        long sleepMillis = 1000 * delaySecs;

        if (sleepMillis > 0) {
          Timer t = new Timer("EbeanCacheWarmer", true);
          t.schedule(new CacheWarmer(server), sleepMillis);
        }
      }

      // start any services after registering with clusterManager
      server.start();
View Full Code Here


    private void beginCheckpoint(final ProcessingInfo processingInfo) throws Exception {
        if (checkpointPolicy.equals("item")) {
            if (timeLimit > 0) {
                final Timer timer = new Timer("chunk-checkpoint-timer", true);
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        processingInfo.timerExpired = true;
                    }
                }, timeLimit * 1000);
 
View Full Code Here

            throw new IllegalStateException("script does not exist");
        String intervalParam = getInitParameter("interval");
        if(intervalParam!=null)
            _interval = Long.parseLong(intervalParam);       
        Timer timer = new Timer();       
        timer.schedule(new TimerTask(){           
            public void run()
            {               
                long modified = _scriptFile.lastModified();               
                if(_lastModified==0)
                {                   
View Full Code Here

      validateState(getWebmasterEmailAddress(), aToAddresses, aSubject, aBody);
      if (isEmailSeparateThread()) {
        fLogger.fine("Sending email on separate thread.");
        TimerTask emailTask = new EmailTask(getWebmasterEmailAddress(), aToAddresses, aSubject, aBody);
        Timer timer = new Timer();
        timer.schedule(emailTask, IMMEDIATELY);
      }
      else {
        fLogger.fine("Sending email using current thread.");
        sendEmail(getWebmasterEmailAddress(), aToAddresses, aSubject, aBody);
      }
View Full Code Here

    private void beginCheckpoint(final ProcessingInfo processingInfo) throws Exception {
        if (checkpointPolicy.equals("item")) {
            if (timeLimit > 0) {
                final Timer timer = new Timer("chunk-checkpoint-timer", true);
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        processingInfo.timerExpired = true;
                    }
                }, timeLimit * 1000);
 
View Full Code Here

    Timer t = null;
    try {
      // Ensure a task is run
      t = new Timer(true);
      TimerTestTask testTask = new TimerTestTask();
      t.schedule(testTask, 200);
      synchronized (sync) {
        try {
          sync.wait(1000);
        } catch (InterruptedException e) {
        }
View Full Code Here

    Timer t = null;
    try {
      // Ensure a task is run
      t = new Timer();
      TimerTestTask testTask = new TimerTestTask();
      t.schedule(testTask, 200);
      synchronized (sync) {
        try {
          sync.wait(1000);
        } catch (InterruptedException e) {
        }
View Full Code Here

        Timer t = null;
        try {
            // Ensure a task is run
            t = new Timer("test_ConstructorSZThread", true);
            TimerTestTask testTask = new TimerTestTask();
            t.schedule(testTask, 200);
            synchronized (sync) {
                try {
                    sync.wait(1000);
                } catch (InterruptedException e) {}
            }
View Full Code Here

        Timer t = null;
        try {
            // Ensure a task is run
            t = new Timer("test_ConstructorSThread");
            TimerTestTask testTask = new TimerTestTask();
            t.schedule(testTask, 200);
            synchronized (sync) {
                try {
                    sync.wait(1000);
                } catch (InterruptedException e) {}
            }
View Full Code Here

      t = new Timer();
      TimerTestTask testTask = new TimerTestTask();
      t.cancel();
      boolean exception = false;
      try {
        t.schedule(testTask, 100, 200);
      } catch (IllegalStateException e) {
        exception = true;
      }
      assertTrue(
          "Scheduling a task after Timer.cancel() should throw exception",
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.