Package org.mortbay.util.ajax

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


      synchronized (queue.getActivationLock()) {
        if (wait) {
          final Continuation cont = ContinuationSupport.getContinuation(httpServletRequest, queue);
          if (!cont.isResumed() && !queue.messagesWaiting()) {
            queue.setActivationCallback(new JettyQueueActivationCallback(cont));
            cont.suspend(45 * 1000);
            return;
          }
        }

        pollQueue(queue, stream, httpServletResponse);
View Full Code Here


                if (!sync) {
                    // Wait for the exchange to get processed.
                    // This might block until it completes or it might return via an exception and
                    // then this method is re-invoked once the the exchange has finished processing
                    continuation.suspend(0);
                }

                // HC: The getBinding() is interesting because it illustrates the
                // impedance miss-match between HTTP's stream oriented protocol, and
                // Camels more message oriented protocol exchanges.
View Full Code Here

                    long to = this.timeout;
                    if (to == 0) {
                        to = ((HttpComponent) getServiceUnit().getComponent()).getConfiguration()
                                            .getConsumerProcessorSuspendTime();
                    }
                    boolean result = cont.suspend(to);
                    exchanges.remove(exchange.getExchangeId());
                    if (!result) {
                        locks.remove(exchange.getExchangeId());
                        throw new Exception("Exchange timed out");
                    }
View Full Code Here

            } else {
                String id = (String) request.getAttribute(MessageExchange.class.getName());
                locks.remove(id);
                exchange = 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

                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

            }
        } else {
            String id = (String) request.getAttribute(MessageExchange.class.getName());
            exchange = 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

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

                    continuation.reset();
                }
View Full Code Here

        HttpServletRequest request = getThreadLocalRequest();
        Continuation continuation = ContinuationSupport.getContinuation(request, null);
        if(continuation.isNew() || !continuation.isPending())
        {
            request.setAttribute("ts", Long.valueOf(System.currentTimeMillis()));
            continuation.suspend(5000);       
        }
        long elapsed = System.currentTimeMillis() - ((Long)request.getAttribute("ts")).longValue();
        return "Hello world *" + sender + "* resumed after " + elapsed + " ms";
    }   

View Full Code Here

                if (hasContent)
                    exchange.setRequestContentSource(in);

                _client.send(exchange);

                continuation.suspend(30000);
            }
        }
    }

View Full Code Here

        }
       
        if (request.getParameter("continue")!=null)
        {
            Continuation continuation = ContinuationSupport.getContinuation(request, null);
            continuation.suspend(Long.parseLong(request.getParameter("continue")));
        }
       
        base_request.setHandled(true);
        response.setHeader(HttpHeaders.CONTENT_TYPE,MimeTypes.TEXT_HTML);
       
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.