Package org.mortbay.util.ajax

Examples of org.mortbay.util.ajax.Continuation.suspend()


        synchronized (queue.getActivationLock()) {
          final Continuation cont = ContinuationSupport.getContinuation(httpServletRequest, queue);

          if (!cont.isResumed() && !queue.messagesWaiting()) {
            queue.setActivationCallback(new JettyQueueActivationCallback(cont));
            if (cont.suspend(30 * 1000)) {
              return;
            }
          }
        }
      }
View Full Code Here


                                cont.resume();
                            }
                        });

                        if (!queue.messagesWaiting()) {
                            cont.suspend(45 * 1000);
                        }
                    } else {
                        queue.setActivationCallback(null);
                    }

View Full Code Here

            // This will throw an exception
            action = suspended(req, response);
            if (action.type() == Action.TYPE.SUSPEND) {
                // Do nothing except setting the times out
                if (action.timeout() != -1) {
                    c.suspend(action.timeout());
                } else {
                    c.suspend(0);
                }
            } else if (action.type() == Action.TYPE.RESUME) {
                if (!resumed.remove(c)) {
View Full Code Here

            if (action.type() == Action.TYPE.SUSPEND) {
                // Do nothing except setting the times out
                if (action.timeout() != -1) {
                    c.suspend(action.timeout());
                } else {
                    c.suspend(0);
                }
            } else if (action.type() == Action.TYPE.RESUME) {
                if (!resumed.remove(c)) {
                    c.reset();
View Full Code Here

        synchronized (queue.getActivationLock()) {
          final Continuation cont = ContinuationSupport.getContinuation(httpServletRequest, queue);

          if (!cont.isResumed() && !queue.messagesWaiting()) {
            queue.setActivationCallback(new JettyQueueActivationCallback(cont));
            if (cont.suspend(30 * 1000)) {
              return;
            }
          }
        }
      }
View Full Code Here

          if (!queue.messagesWaiting()) {

            queue.setActivationCallback(new JettyQueueActivationCallback(cont));

            if (!queue.messagesWaiting()) {
              cont.suspend(45 * 1000);
            }
          }
          else {
            queue.setActivationCallback(null);
          }
View Full Code Here

        EasyMock.expectLastCall();
        c.reset();
        EasyMock.expectLastCall();
        c.resume();
        EasyMock.expectLastCall();
        c.suspend(100);
        EasyMock.expectLastCall().andReturn(true);
        EasyMock.replay(c);
       
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        request.getAttribute("org.mortbay.jetty.ajax.Continuation");
View Full Code Here

                // register this continuation with our listener.
                listener.setContinuation(continuation);

                // Get the continuation object (may wait and/or retry
                // request here).
                continuation.suspend(timeout);
            }
            listener.setContinuation(null);

            // prepare the responds
            response.setContentType("text/xml");
View Full Code Here

                    // register this continuation with our listener.
                    listener.setContinuation(continuation);

                    // Get the continuation object (may wait and/or retry
                    // request here).
                    continuation.suspend(timeout);
                }

                // Try again now
                if (message == null) {
                    message = consumer.receiveNoWait();
View Full Code Here

                synchronized (cont) {
                    channel.send(exchange);
                    if (log.isDebugEnabled()) {
                        log.debug("Suspending continuation for exchange: " + exchange.getExchangeId());
                    }
                    boolean result = cont.suspend(suspentionTime);
                    exchanges.remove(exchange.getExchangeId());
                    if (!result) {
                        throw new Exception("Error sending exchange: aborted");
                    }
                    request.removeAttribute(MessageExchange.class.getName());
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.