Package org.eclipse.jetty.continuation

Examples of org.eclipse.jetty.continuation.Continuation.suspend()


                else {
                    // Jetty 7 does something really weird if you set it to
                    // Long.MAX_VALUE, which is to resume automatically.
                    c.setTimeout(Integer.MAX_VALUE);
                }
                c.suspend();
            }
            else if (action.type == Action.TYPE.RESUME) {
                logger.debug("Resume {}", res);

                if (!resumed.remove(c)) {
View Full Code Here


                                            // Support old clients that do not send advice:{timeout:0} on the first connect
                                            if (timeout > 0 && wasConnected && session.isConnected()) {
                                                // Suspend and wait for messages
                                                Continuation continuation = ContinuationSupport.getContinuation(request);
                                                continuation.setTimeout(timeout);
                                                continuation.suspend(response);
                                                scheduler = new LongPollScheduler(session, continuation, reply, browserId);
                                                session.setScheduler(scheduler);
                                                request.setAttribute(LongPollScheduler.ATTRIBUTE, scheduler);
                                                reply = null;
                                                metaConnectSuspended(request, session, timeout);
View Full Code Here

                } else {
                    // Jetty 7 does something really weird if you set it to
                    // Long.MAX_VALUE, which is to resume automatically.
                    c.setTimeout(Integer.MAX_VALUE);
                }
                c.suspend();
            } else if (action.type == Action.TYPE.RESUME) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Resume " + res);
                }
View Full Code Here

        } else {
            //save the continuation to get the servlet response
            Continuation continuation = ContinuationSupport.getContinuation(req);
            // optionally set a timeout to avoid suspending requests for too long
            continuation.setTimeout(0);
            continuation.suspend();
            continuations.offer(continuation);
        }
    }

    @Validate
View Full Code Here

                log.error("Error processing request", e);
                throw new ServletException(e);
            }

            // must suspend before we process the exchange
            continuation.suspend();

            ClassLoader oldTccl = overrideTccl(exchange);

            if (log.isTraceEnabled()) {
                log.trace("Processing request for exchangeId: {}", exchange.getExchangeId());
View Full Code Here

       
        Continuation continuation = ContinuationSupport.getContinuation(br.getHttpServletRequest());
        addContinuationExpirationListener(continuation);
        continuation.setTimeout(wait * 1000);
        continuation.setAttribute("request", br);
        continuation.suspend();
       
        if (highestReadRid != null && highestReadRid + requests < br.getRid()) {
            LOGGER.warn("BOSH received RID greater than the permitted window of concurrent requests");
            error(br, "item-not-found");
            return;
View Full Code Here

        HttpServletRequest httpServletRequest = mocksControl.createMock(HttpServletRequest.class);
        Continuation continuation = mocksControl.createMock(Continuation.class);
        expect(httpServletRequest.getAttribute(Continuation.ATTRIBUTE)).andReturn(continuation);
        expectLastCall().atLeastOnce();
        continuation.setTimeout(anyLong());
        continuation.suspend();
        continuation.setAttribute(eq("request"), EasyMock.<BoshRequest> notNull());

        continuation.addContinuationListener(EasyMock.<ContinuationListener> anyObject());

        Stanza body1 = mocksControl.createMock(Stanza.class);
View Full Code Here

        expectLastCall().atLeastOnce();
        continuation.setTimeout(anyLong());
        Capture<BoshRequest> br = new Capture<BoshRequest>();
        continuation.setAttribute(eq("request"), EasyMock.<BoshRequest> capture(br));
        continuation.addContinuationListener(EasyMock.<ContinuationListener> anyObject());
        continuation.suspend();

        ServerFeatures serverFeatures = mocksControl.createMock(ServerFeatures.class);
        expect(serverRuntimeContext.getServerFeatures()).andReturn(serverFeatures);
        expect(serverFeatures.getAuthenticationMethods()).andReturn(Collections.<SASLMechanism> emptyList());
View Full Code Here

        // test session retrieval, retrieves the session above identified by sid=200
        mocksControl.reset();
        expect(httpServletRequest.getAttribute(Continuation.ATTRIBUTE)).andReturn(continuation);
        expectLastCall().atLeastOnce();
        continuation.setTimeout(anyLong());
        continuation.suspend();
        continuation.setAttribute(eq("request"), EasyMock.<BoshRequest> capture(br));
        continuation.addContinuationListener(EasyMock.<ContinuationListener> anyObject());
        StanzaProcessor stanzaProcessor = mocksControl.createMock(StanzaProcessor.class);
        expect(serverRuntimeContext.getStanzaProcessor()).andReturn(stanzaProcessor);
        Capture<Stanza> stanzaCaptured = new Capture<Stanza>();
View Full Code Here

        HttpServletRequest httpServletRequest = mocksControl.createMock(HttpServletRequest.class);
        expect(httpServletRequest.getAttribute(Continuation.ATTRIBUTE)).andReturn(continuation);
        expectLastCall().atLeastOnce();
        continuation.setTimeout(anyLong());
        continuation.setAttribute(eq("request"), EasyMock.<BoshRequest> notNull());
        continuation.suspend();
        continuation.resume();
        continuation.addContinuationListener(EasyMock.<ContinuationListener> anyObject());
        Capture<BoshResponse> captured = new Capture<BoshResponse>();
        continuation.setAttribute(eq("response"), EasyMock.<BoshResponse> capture(captured));
        mocksControl.replay();
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.