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


        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

                // 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

                setupRequestMessage(request, requestMessage, receiver);

                //we force asynchronous in the {@link #routeMessage} method
                routeMessage(receiver, requestMessage, request);

                continuation.suspend(10000);
            }

            writeResponse(response, (MuleMessage) continuation.getObject());
        }
        catch (Exception e)
View Full Code Here

                    if (exchanges.remove(exchange.getExchangeId()) == null) {
                        if (log.isDebugEnabled()) {
                            log.debug("Suspending continuation for exchange: " + exchange.getExchangeId());
                        }
                        // TODO: make this timeout configurable
                        boolean result = cont.suspend(1000 * 60); // 60 s
                        if (!result) {
                            throw new Exception("Error sending exchange: aborted");
                        }
                    }
                    request.removeAttribute(MessageExchange.class.getName());
View Full Code Here

            }
        } else {
            String id = (String) request.getAttribute(MessageExchange.class.getName());
            exchange = (MessageExchange) exchanges.remove(id);
            request.removeAttribute(MessageExchange.class.getName());
            boolean result = cont.suspend(0);
            // Check if this is a timeout
            if (exchange == null) {
                throw new IllegalStateException("Exchange not found");
            }
            if (!result) {
View Full Code Here

                    // else, the call will block until the continuation is resumed
                    long to = this.timeout;
                    if (to == 0) {
                        to = ((HttpComponent) getServiceUnit().getComponent()).getConfiguration().getConsumerProcessorSuspendTime();
                    }
                    boolean result = cont.suspend(to);
                    // The call has not thrown a RetryRequest, which means we don't use a SelectConnector
                    // and we must handle the exchange in this very method call.
                    // If result is false, the continuation has timed out.
                    // So get the exchange (in case the object has changed) and remove it from the map
                    exchange = exchanges.remove(exchange.getExchangeId());
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);
                    exchange = exchanges.remove(exchange.getExchangeId());
                    request.removeAttribute(MessageExchange.class.getName());
                    if (!result) {
                        locks.remove(exchange.getExchangeId());
                        throw new Exception("Exchange timed out");
View Full Code Here

                    {
                        // save state and suspend
                        ((ContinuationClient)client).setContinuation(continuation);
                        request.setAttribute(CLIENT_ATTR,client);
                        request.setAttribute(TRANSPORT_ATTR,transport);
                        continuation.suspend(timeout);
                    }

                    if (!continuation.isPending())
                        client.access();
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.