Package org.apache.cxf.continuations

Examples of org.apache.cxf.continuations.Continuation


    }
   
    @GET
    @Path("{id}")
    public String handleContinuationRequest(@PathParam("id") String id) {
        Continuation continuation = getContinuation(id);
        if (continuation == null) {
            throw new RuntimeException("Failed to get continuation");
        }
        synchronized (continuation) {
            if (continuation.isNew()) {
                continuation.setObject(id);
                suspendInvocation(id, continuation);
            } else {
                String savedId = continuation.getObject().toString();
                if (!savedId.equals(id)) {
                    throw new RuntimeException("SavedId is wrong");
                }
                return books.get(savedId);
            }
View Full Code Here


        return null;
    }
   
    private void resumeRequest(final String name) {
       
        Continuation suspendedCont = null;
        synchronized (suspended) {
            suspendedCont = suspended.get(name);
        }
       
        if (suspendedCont != null) {
            synchronized (suspendedCont) {
                suspendedCont.resume();
            }
        }
    }
View Full Code Here

    private Continuation getContinuation(String name) {
       
        System.out.println("Getting continuation for " + name);
       
        synchronized (suspended) {
            Continuation suspendedCont = suspended.remove(name);
            if (suspendedCont != null) {
                return suspendedCont;
            }
        }
       
View Full Code Here

    @Resource
    private WebServiceContext context;
   
    public String sayHi(String firstName, String secondName) {
       
        Continuation continuation = getContinuation(firstName);
        if (continuation == null) {
            throw new RuntimeException("Failed to get continuation");
        }
        synchronized (continuation) {
            if (continuation.isNew()) {
                Object userObject = secondName != null && secondName.length() > 0
                                    ? secondName : null;
                continuation.setObject(userObject);
                suspendInvocation(firstName, continuation);
            } else {
                if (!continuation.isResumed()) {
                    throw new RuntimeException("No timeout expected");
                }
                StringBuilder sb = new StringBuilder();
                sb.append(firstName);
               
                // if the actual parameter is not null
                if (secondName != null && secondName.length() > 0) {
                    String surname = continuation.getObject().toString();
                    sb.append(' ').append(surname);
                }
                System.out.println("Saying hi to " + sb.toString());
                return "Hi " + sb.toString();
            }
View Full Code Here

        return true;
    }

    public void resumeRequest(final String name) {
       
        Continuation suspendedCont = null;
        synchronized (suspended) {
            suspendedCont = suspended.get(name);
        }
       
        if (suspendedCont != null) {
            synchronized (suspendedCont) {
                suspendedCont.resume();
            }
        }
    }
View Full Code Here

    private Continuation getContinuation(String name) {
       
        System.out.println("Getting continuation for " + name);
       
        synchronized (suspended) {
            Continuation suspendedCont = suspended.remove(name);
            if (suspendedCont != null) {
                return suspendedCont;
            }
        }
       
View Full Code Here

    @Resource
    private WebServiceContext context;
   
    public String sayHi(String firstName, String secondName) {
       
        Continuation continuation = getContinuation(firstName);
        if (continuation == null) {
            throw new RuntimeException("Failed to get continuation");
        }
        synchronized (continuation) {
            if (continuation.isNew()) {
                Object userObject = secondName != null && secondName.length() > 0
                                    ? secondName : null;
                continuation.setObject(userObject);
                suspendInvocation(firstName, continuation);
            } else {
                if (!continuation.isResumed() && !"Fred".equals(firstName)) {
                    throw new RuntimeException("No timeout expected");
                }
                StringBuilder sb = new StringBuilder();
                sb.append(firstName);
               
                // if the actual parameter is not null
                if (secondName != null && secondName.length() > 0) {
                    String surname = continuation.getObject().toString();
                    sb.append(' ').append(surname);
                }
                System.out.println("Saying hi to " + sb.toString());
                return "Hi " + sb.toString();
            }
View Full Code Here

        return true;
    }

    public void resumeRequest(final String name) {
       
        Continuation suspendedCont = null;
        synchronized (suspended) {
            suspendedCont = suspended.get(name);
        }
       
        if (suspendedCont != null) {
            synchronized (suspendedCont) {
                suspendedCont.resume();
            }
        }
    }
View Full Code Here

    private Continuation getContinuation(String name) {
       
        System.out.println("Getting continuation for " + name);
       
        synchronized (suspended) {
            Continuation suspendedCont = suspended.remove(name);
            if (suspendedCont != null) {
                return suspendedCont;
            }
        }
       
View Full Code Here

     * @param mn message number
     * @return <code>true</code> if message processing to continue, <code>false</code> if to be dropped
     * @throws Fault if message had already been acknowledged
     */
    boolean applyDeliveryAssurance(long mn, Message message) throws RMException {
        Continuation cont = getContinuation(message);
        DeliveryAssuranceType da = destination.getManager().getDeliveryAssurance();
        if (cont != null && da.isSetInOrder() && !cont.isNew()) {
            return waitInQueue(mn, !(da.isSetAtLeastOnce() || da.isSetExactlyOnce()),
                               message, cont);
        }
        if ((da.isSetExactlyOnce() || da.isSetAtMostOnce()) && isAcknowledged(mn)) {           
            org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(
View Full Code Here

TOP

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

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.