Package org.jboss.netty.util

Examples of org.jboss.netty.util.Timeout


    result = q.offer((T) e);
    if (q.size() >= _sizes[group])
    {
      // if queue is full remove an element and undo its timer
      T o = q.remove();
      Timeout timer = _timers.remove(o);
      if (timer != null)
        timer.cancel();
      Constants.ahessianLogger.warn("queue overflow -> removed "+e);
    }
    if (result)
      _last = e;
   
    if (_timer != null && result && _timeouts[group] > 0)
    {
      Timeout timer = _timer.newTimeout(new TimerTask()
      {

        public void run(Timeout arg0) throws Exception
        {
          _lock.lock();
View Full Code Here


    if (q != null)
    {
      result = q.poll();
      if (result != null)
      {
        Timeout timer = _timers.remove(result);
        if (timer != null)
          timer.cancel();
      }
    }
    return result;
  }
View Full Code Here

    _timeout = timeOut;
  }
 
  public Timeout removeTimeout()
  {
    Timeout result = _timeout;
    _timeout = null;
    return result;
  }
View Full Code Here

  {
    _hasSession = true;
    session.setClosed(false);
   
    // if we have a session timeout set, cancel it.
    Timeout timeOut = session.removeTimeout();
    if (timeOut != null)
      timeOut.cancel();
   
    // check if the session is already connected to a channel
    Channel c = pipeline.getChannel();
    if (c != null && c.isOpen())
    {
View Full Code Here

    _sessionId = "";
    _connectedEvent = null;
    _channel = null;
    if (_sessionTimeout > 0)
    {
      Timeout timeOut = _timer.newTimeout(new TimerTask()
      {

        public void run(Timeout arg0) throws Exception
        {
          ((Session)ctx.getAttachment()).invalidate();
View Full Code Here

 
  /**
   * Resets the timeout on this channel
   */
  protected void resetTimer() {
    Timeout t = timerTimeout.getAndSet(timer.newTimeout(this, this.timeout, TimeUnit.MILLISECONDS));
    if(t!=null) {
      t.cancel();
    }
  }
View Full Code Here

  /**
   * @return
   * @see org.jboss.netty.channel.Channel#close()
   */
  public ChannelFuture close() {
    Timeout t = timerTimeout.getAndSet(null);
    if(t!=null) t.cancel();
    return channel.close();
  }
View Full Code Here

        cancelRequestTimeouts(request);
    }

    private void cancelRequestTimeouts(Request request)
    {
        Timeout sendTimeout = request.getSendTimeout();
        if (sendTimeout != null && !sendTimeout.isCancelled()) {
            sendTimeout.cancel();
        }

        Timeout receiveTimeout = request.getReceiveTimeout();
        if (receiveTimeout != null && !receiveTimeout.isCancelled()) {
            receiveTimeout.cancel();
        }

        Timeout readTimeout = request.getReadTimeout();
        if (readTimeout != null && !readTimeout.isCancelled()) {
            readTimeout.cancel();
        }
    }
View Full Code Here

                    public void run(Timeout timeout) {
                        onSendTimeoutFired(request);
                    }
                });

                Timeout sendTimeout;
                try {
                    sendTimeout = timer.newTimeout(sendTimeoutTask, sendTimeoutMs, TimeUnit.MILLISECONDS);
                }
                catch (IllegalStateException e) {
                    throw new TTransportException("Unable to schedule send timeout");
View Full Code Here

                    public void run(Timeout timeout) {
                        onReceiveTimeoutFired(request);
                    }
                });

                Timeout timeout;
                try {
                    timeout = timer.newTimeout(receiveTimeoutTask, receiveTimeoutMs, TimeUnit.MILLISECONDS);
                }
                catch (IllegalStateException e) {
                    throw new TTransportException("Unable to schedule request timeout");
                }
                request.setReceiveTimeout(timeout);
            }
        }

        if (this.readTimeout != null) {
            long readTimeoutNanos = this.readTimeout.roundTo(TimeUnit.NANOSECONDS);
            if (readTimeoutNanos > 0) {
                TimerTask readTimeoutTask = new IoThreadBoundTimerTask(this, new ReadTimeoutTask(readTimeoutNanos, request));

                Timeout timeout;
                try {
                    timeout = timer.newTimeout(readTimeoutTask, readTimeoutNanos, TimeUnit.NANOSECONDS);
                }
                catch (IllegalStateException e) {
                    throw new TTransportException("Unable to schedule read timeout");
View Full Code Here

TOP

Related Classes of org.jboss.netty.util.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.