Package org.apache.cxf.continuations

Examples of org.apache.cxf.continuations.ContinuationProvider


                }
                return null;
            }

            private Continuation getContinuation(Exchange cxfExchange) {
                ContinuationProvider provider =
                    (ContinuationProvider)cxfExchange.getInMessage().get(ContinuationProvider.class.getName());
                return provider == null ? null : provider.getContinuation();
            }
           
            private Object syncInvoke(Exchange cxfExchange) {
                org.apache.camel.Exchange camelExchange = perpareCamelExchange(cxfExchange);              
                // send Camel exchange to the target processor
View Full Code Here


                    //
                    //mimic a slow server by delaying somewhere between
                    //1 and 2 seconds, with a preference of delaying the earlier
                    //requests longer to create a sort of backlog/contention
                    //with the later requests
                    ContinuationProvider p = (ContinuationProvider)
                        getContext().getMessageContext().get(ContinuationProvider.class.getName());
                    Continuation c = p.getContinuation();
                    if (c.isNew()) {
                        if (cnt < 0) {
                            c.suspend(-cnt);
                        } else {
                            c.suspend(2000 - (cnt % 1000));
View Full Code Here

   
    public SOAPMessage invoke(SOAPMessage request) {
        try {
            final MessageContext messageContext = ctx.getMessageContext();

            ContinuationProvider contProvider =
                (ContinuationProvider) messageContext.get(ContinuationProvider.class.getName());
            final Continuation continuation = contProvider.getContinuation();
           
            if (continuation.isNew()) {
                continuation.suspend(5000);
                new Thread(new Runnable() {
                    public void run() {
View Full Code Here

        return null;       
    }
   
    private Continuation getContinuation(String name) {
       
        ContinuationProvider provider =
            (ContinuationProvider)context.getMessageContext().get(ContinuationProvider.class.getName());
        return provider.getContinuation();
    }
View Full Code Here

   
    public SOAPMessage invoke(SOAPMessage request) {
        try {
            final MessageContext messageContext = ctx.getMessageContext();

            ContinuationProvider contProvider =
                (ContinuationProvider) messageContext.get(ContinuationProvider.class.getName());
            final Continuation continuation = contProvider.getContinuation();
           
            if (continuation.isNew()) {
                continuation.suspend(5000);
                new Thread(new Runnable() {
                    public void run() {
View Full Code Here

            });
        }
    }
   
    private Continuation getContinuation(String name) {
        ContinuationProvider provider =
            (ContinuationProvider)context.get(ContinuationProvider.class.getName());
        if (provider == null) {
            Message m = PhaseInterceptorChain.getCurrentMessage();
            UriInfo uriInfo = new UriInfoImpl(m);
            if (uriInfo.getAbsolutePath().toString().contains("/books/subresources/")) {
                // when we suspend a CXF continuation from a sub-resource, the invocation will
                // return directly to that object - and sub-resources do not have contexts supported
                // by default - so we just need to depend on PhaseInterceptorChain
                provider = (ContinuationProvider)m.get(ContinuationProvider.class.getName());
            }
        }
        if (provider == null) {
            throw new WebApplicationException(500);
        }
       
        synchronized (suspended) {
            Continuation suspendedCont = suspended.remove(name);
            if (suspendedCont != null) {
                return suspendedCont;
            }
        }
       
        return provider.getContinuation();
    }
View Full Code Here

        try {
            if (isServlet3 && req.isAsyncSupported()) {
                inMessage.put(ContinuationProvider.class.getName(),
                              new Servlet3ContinuationProvider(req, resp, inMessage));
            } else if (cproviderFactory != null) {
                ContinuationProvider p = cproviderFactory.createContinuationProvider(inMessage, req, resp);
                if (p != null) {
                    inMessage.put(ContinuationProvider.class.getName(), p);
                }
            }
        } catch (Throwable ex) {
View Full Code Here

            if (suspendedCont != null) {
                return suspendedCont;
            }
        }
       
        ContinuationProvider provider =
            (ContinuationProvider)context.get(ContinuationProvider.class.getName());
        return provider.getContinuation();
    }
View Full Code Here

            }
        }
    }

    private void initContinuation() {
        ContinuationProvider provider =
            (ContinuationProvider)inMessage.get(ContinuationProvider.class.getName());
        cont = provider.getContinuation();
        initialSuspend = true;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.continuations.ContinuationProvider

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.