Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.I_Timeout


         //this.handler.shutdown();
        
         // Give a Authenticate.connect exception to be delivered to the client
         // or the client some chance to close the socket itself after disconnect
         long delay = 5000; // 5 sec
         glob.getBurstModeTimer().addTimeoutListener(new I_Timeout() {
               public void timeout(Object userData) {
                  se.shutdown();
                  //handler = null;
               }
            }, delay, null);
View Full Code Here


      System.out.println("***TimeoutTest: testTimeout ...");

      {
         event = false;
         Timeout timeout = new Timeout(ME);
         Timestamp timeoutHandle = timeout.addTimeoutListener(new I_Timeout() {
               public void timeout(Object userData) {
                  event = true;
                  log.info("Timeout happened after 0 millisec");
               }
            },
            0L, null);

         try { Thread.sleep(100L); } catch (InterruptedException e) {}
         assertEquals("Timeout not occurred after 0 msec.", true, event);
      }
     
      {
         event = false;
         Timeout timeout = new Timeout(ME);
         Timestamp timeoutHandle = timeout.addTimeoutListener(new I_Timeout() {
               public void timeout(Object userData) {
                  event = true;
                  log.info("Timeout happened after 500 millisec");
               }
            },
            500L, null);

         try { Thread.sleep(800L); } catch (InterruptedException e) {}
         assertEquals("Timeout not occurred after 1 sec.", true, event);
      }
     
      {
         event = false;
         Timeout timeout = new Timeout(ME);
         Timestamp timeoutHandle = timeout.addTimeoutListener(new I_Timeout() {
               public void timeout(Object userData) {
                  event = true;
                  log.severe("Timeout happened after 1 sec");
               }
            },
View Full Code Here

                  this.heartbeatInterval = Constants.DAY_IN_MILLIS;
               if (this.heartbeatInterval > 0) {
                  // send the first heartbeat directly after startup:
                  long initialInterval = (this.heartbeatInterval > 2000) ? 2000L : this.heartbeatInterval;
                  this.heartbeatTimeout = new Timeout("EventPlugin-HeartbeatTimer");
                  this.heartbeatTimeoutHandle = this.heartbeatTimeout.addTimeoutListener(new I_Timeout() {
                     public void timeout(Object userData) {
                        log.fine("Timeout happened " + userData + ": Sending now heartbeat");
                        newHeartbeatNotification((String)userData);
                        try {
                           heartbeatTimeout.addOrRefreshTimeoutListener(this, heartbeatInterval, userData, heartbeatTimeoutHandle);
View Full Code Here

         synchronized(this.smtpDestinationMonitor) {
            // If no timer was active send immeditately (usually the first email)
            if (this.smtpTimeoutHandle == null) {
               this.currentEmailData = null;
               this.smtpTimeout.addTimeoutListener(new I_Timeout() {
                  public void timeout(Object userData) {
                     try {
                        smtpDestinationHelper.smtpClient.sendEmail(emailData);
                     } catch (Throwable e) {
                        e.printStackTrace();
                     }
                  }
               }, 1, null); // after 1 milli, dispatch to timer thread
            }
            else {
               // If a timer is active return, the timout will send the mail
               this.currentEmailData = emailData;
               return;
            }

            // Now span timer, other emails are collected until this timer elapses
            if (this.smtpDestinationHelper.collectIntervall > 0) {
               this.smtpTimeoutHandle = this.smtpTimeout.addTimeoutListener(new I_Timeout() {
                  public void timeout(Object userData) {
                     synchronized(smtpDestinationMonitor) {
                        smtpTimeoutHandle = null;
                        if (currentEmailData == null) return;
                        try {
View Full Code Here

      final long MIN = 2000L; // Sessions which live less than 2 seconds are not supported
      if (sessionTimeout >= MIN) {
         long gap = (sessionTimeout < 60*1000L) ? sessionTimeout/2 : sessionTimeout-30*1000L;
         final long refreshTimeout = sessionTimeout - gap;
         final Timeout timeout = this.glob.getPingTimer();
         this.sessionRefreshTimeoutHandle = timeout.addTimeoutListener(new I_Timeout() {
               public void timeout(Object userData) {
                  if (isAlive()) {
                     if (log.isLoggable(Level.FINE)) log.fine(getLogId()+"Refreshing session to not expire");
                     try {
                        refreshSession();
View Full Code Here

         return;
      }

      final long exitSleep = glob.getProperty().get("xmlBlaster.exit.delay", 2000L);
      Timeout exitTimeout = new Timeout("XmlBlaster ExitTimer");
      exitTimeout.addTimeoutListener(new I_Timeout() {
            public void timeout(Object userData) {
               log.info("Administrative exit(" + exitVal + ") after exit-timeout of " + exitSleep + " millis.");
               try {
                  glob.getRunlevelManager().changeRunlevel(RunlevelManager.RUNLEVEL_HALTED, true);
               }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.I_Timeout

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.