Examples of Timeout


Examples of org.xmlBlaster.util.Timeout

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

Examples of org.xmlBlaster.util.Timeout

   public void setupSmtpSink(String destination) throws XmlBlasterException {
      if (destination != null && destination.trim().length() > 0) {
         synchronized(this.smtpDestinationMonitor) {
            this.smtpDestinationHelper = new SmtpDestinationHelper(getSmtpClient(), destination);
            //if (this.smtpDestination.collectIntervall > 0)
            this.smtpTimeout = new Timeout("EventPlugin-SmtpTimer"); // we need it allways to synchronize
         }
      }
   }
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

      if (this.waitForChunksTimeout > 0L) {
         String timerName = StreamingCallback.class.getName() + "-timer";
         synchronized(this.global) {
            this.timer = (Timeout)this.global.getObjectEntry(timerName);
            if (this.timer == null) {
               this.timer = new Timeout(timerName);
               this.global.addObjectEntry(timerName, this.timer);
            }
         }
      }
      this.useQueue = useQueue;
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

    * Call this to reactivate the session expiry to full value
    */
   public final void refreshSession() throws XmlBlasterException {
      if (connectQos.getSessionTimeout() > 0L) {
         synchronized (this.EXPIRY_TIMER_MONITOR) {
            Timeout expiryTimer = this.expiryTimer;
            if (expiryTimer != null) {
               this.timerKey = expiryTimer.addOrRefreshTimeoutListener(this, connectQos.getSessionTimeout(), null, this.timerKey);
            }
         }
      }
      else {
         removeExpiryTimer();
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

      if (extraOffset == null) extraOffset = "";
      String offset = Constants.OFFSET + extraOffset;

      sb.append(offset).append("<SessionInfo id='").append(getId());

      Timeout expiryTimer = this.expiryTimer;
      long timeToLife = (expiryTimer != null) ? expiryTimer.spanToTimeout(timerKey) : 0;
      sb.append("' timeout='").append(timeToLife).append("'>");

      // Avoid dump of password
      if (props == null) props = new Properties();
      props.put(Constants.TOXML_NOSECURITY, ""+true);
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

      long sessionTimeout = this.connectQos.getSessionQos().getSessionTimeout();
      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();
                     }
                     catch (XmlBlasterException e) {
                        log.warning(getLogId()+"Can't refresh the login session '" + getId() + "': " + e.toString());
                     }
                  }
                  else {
                     if (log.isLoggable(Level.FINE)) log.fine(getLogId()+"Can't refresh session as we have no connection");
                  }
                  try {
                     sessionRefreshTimeoutHandle = timeout.addOrRefreshTimeoutListener(this, refreshTimeout, null, sessionRefreshTimeoutHandle) ;
                  }
                  catch (XmlBlasterException e) {
                     log.warning(getLogId()+"Can't refresh the login session '" + getId() + "': " + e.toString());
                  }
               }
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

   public Timeout getTransistionTimer() {
      if (this.transitionTimer == null) {
         synchronized(this) {
            if (this.transitionTimer == null)
               this.transitionTimer = new Timeout("XmlBlaster.PoolManagerTimer");
         }
      }
      return this.transitionTimer;
   }
View Full Code Here

Examples of org.xmlBlaster.util.Timeout

         log.warning("Ignoring exit(" + exitVal + ") request in embeded mode ('xmlBlaster.isEmbeded' is set true).");
         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

Examples of stormpot.Timeout

  public static void main(String[] args) throws InterruptedException {
    // tag::usageMyApp[]
    MyAllocator allocator = new MyAllocator();
    Config<MyPoolable> config = new Config<MyPoolable>().setAllocator(allocator);
    Pool<MyPoolable> pool = new BlazePool<MyPoolable>(config);
    Timeout timeout = new Timeout(1, TimeUnit.SECONDS);

    MyPoolable object = pool.claim(timeout);
    try {
      // Do stuff with 'object'.
      // Note that 'claim' will return 'null' if it times out!
View Full Code Here

Examples of winterwell.utils.TimeOut

   * Wraps {@link #run()} with timing, thread-naming, and capturing std-out
   * (if set to do so)
   */
  @Override
  public final V call() throws Exception {
    TimeOut timeOut = null;
    try {
      if (status == QStatus.CANCELLED)
        throw new CancellationException();
      start = new Time();
      // set a timer running
      // - can lead to InterruptedExceptions
      if (maxTime > 0) {
        timeOut = new TimeOut(maxTime);
      }
      // assert runner != null;
      status = QStatus.RUNNING;
      thread = Thread.currentThread();
      // Set the thread name (but keep it short)
      // This will always be reset to Done: or Error: by the end of the
      // method call
      thread.setName(StrUtils.ellipsize(name == null ? toString() : name,
          32));
      if (captureStdOut) {
        sysOut = new SysOutCollectorStream();
      }

      // run!
      output = run();

      end = new Time();
      status = QStatus.DONE;
      thread.setName(StrUtils.ellipsize("Done: " + thread.getName(), 32));
      return output;
    } catch (Throwable e) {
      status = QStatus.ERROR;
      if (runner != null) {
        runner.report(this, e);
      }
      thread.setName(StrUtils.ellipsize("Error: " + thread.getName(), 32));
      // There's not much point throwing an exception from within an
      // executor
      // - but it's useful in debugging.
      throw Utils.runtime(e);
    } finally {
      if (timeOut != null) {
        timeOut.cancel();
      }
      if (runner != null) {
        runner.done(this);
      }
      // drop references
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.