Examples of Continuation


Examples of com.cloudbees.groovy.cps.Continuation

    public Next eval(final Env e, final Continuation k) {
        final TryBlockEnv f = new TryBlockEnv(e,finally_);
        // possible evaluation of the finally block, if present.

        for (final CatchExpression c : catches) {
            f.addHandler(c.type, new Continuation() {
                public Next receive(Object t) {
                    BlockScopeEnv b = new BlockScopeEnv(e);
                    b.declareVariable(c.type, c.name);
                    b.setLocalVariable(c.name, t);
View Full Code Here

Examples of com.kurento.kmf.media.Continuation

      return RemoteObjectInvocationHandler.newProxy(remoteObject,
          factory, clazz);

    } else if (name.equals("buildAsync")) {

      @SuppressWarnings("rawtypes")
      final Continuation cont = (Continuation) args[args.length - 1];

      factory.create(clazz.getSimpleName(), props,
          new DefaultContinuation<RemoteObject>(cont) {
            @SuppressWarnings("unchecked")
            @Override
            public void onSuccess(RemoteObject remoteObject) {
              try {
                cont.onSuccess(RemoteObjectInvocationHandler
                    .newProxy(remoteObject, factory, clazz));
              } catch (Exception e) {
                log.warn(
                    "[Continuation] error invoking onSuccess implemented by client",
                    e);
View Full Code Here

Examples of com.microworkflow.execution.Continuation

  public void setJoin(JoinActivity join) {
    this.join = join;
  }

  public void computeStateFor(Continuation k) {
    Continuation joinContinuation = theJoin.continuationWith(k.getNextContinuation());
    ((ForkContinuation)k).setBranches(getContinuationsForComponentsWith(joinContinuation));
 
View Full Code Here

Examples of com.microworkflow.execution.Continuation

  public void setThenBranch(Activity thenBranch) {
    this.thenBranch = thenBranch;
  }

  public void computeStateFor(Continuation k) {
    Continuation next=k.getNextContinuation();
    ConditionalContinuation ck=(ConditionalContinuation)k;
    if (thenBranch != null) {
      ck.setThenContinuation(thenBranch.continuationWith(next));
    } else {
      ck.setThenContinuation(next);
View Full Code Here

Examples of com.sun.jndi.toolkit.ctx.Continuation

     * For each result, create the appropriate NamingEvent and
     * queue to be dispatched to listeners.
     */
    public void run() {
        try {
            Continuation cont = new Continuation();
            cont.setError(this, info.name);
            Name nm = (info.name == null || info.name.equals("")) ?
                new CompositeName() : new CompositeName().add(info.name);

            results = context.searchAux(nm, info.filter, info.controls,
                true, false, cont);
View Full Code Here

Examples of org.apache.cocoon.components.flow.java.Continuation

    }

    public static void testSimpleContinuable() throws Exception {
        ContinuationClassLoader cl = new ContinuationClassLoader(Thread
                .currentThread().getContextClassLoader());
        Continuation continuation = new Continuation(null);
        continuation.registerThread();
        Class clazz = cl.loadClass("org.apache.cocoon.components.flow.java.test.SimpleContinuable");
        Object object = clazz.newInstance();
        clazz.getMethod("suspend", null).invoke(object, null);
        if (continuation.isCapturing())
            continuation.getStack().popReference();
        continuation = new Continuation(continuation, null);
        continuation.registerThread();
        clazz.getMethod("suspend", null).invoke(object, null);
    }
View Full Code Here

Examples of org.apache.commons.javaflow.Continuation

import swarm.javaflow.ContTest;

public class Main {
  public static void main(String[] args) {
    Continuation c = Continuation.startWith(new ContTest());
    System.out.println("returned a continuation");
    Continuation d = Continuation.continueWith(c);
    System.out.println("returned another continuation");
  }
View Full Code Here

Examples of org.apache.cxf.continuations.Continuation

        throw new UnsupportedOperationException();
    }
   
    public String greetMe(String name) {
       
        Continuation continuation = getContinuation(name);
        if (continuation == null) {
            throw new RuntimeException("Failed to get continuation");
        }
        synchronized (continuation) {
            if (continuation.isNew()) {
                if (suspended) {
                    throw new RuntimeException("Was already suspended");
                }
                Object userObject = "Fred".equals(name) ? "Ruby" : null;
                continuation.setObject(userObject);
                suspended = true;
                continuation.suspend(2000);
            } else {
                if (!suspended) {
                    throw new RuntimeException("Was not suspended yet");
                }
                if (continuation.isResumed()) {
                    throw new RuntimeException("It must be a timeout");
                }
                StringBuilder sb = new StringBuilder();
                sb.append(name);
               
                Object userObject = continuation.getObject();
                if (userObject != null) {
                    sb.append(' ').append(userObject.toString());
                }
                System.out.println("Saying hi to " + sb.toString());
                return "Hi " + sb.toString();
View Full Code Here

Examples of org.apache.cxf.continuations.Continuation

                    //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));
                        }
                        return null;
                    }
                    return "Hello, finally! " + cnt;
                }
View Full Code Here

Examples of org.apache.cxf.continuations.Continuation

        ServerFactoryBean svrBean = endpoint.createServerFactoryBean();
        svrBean.setInvoker(new Invoker() {
            // we receive a CXF request when this method is called
            public Object invoke(Exchange cxfExchange, Object o) {
                LOG.trace("Received CXF Request: {}", cxfExchange);               
                Continuation continuation;
                if (!endpoint.isSynchronous() && isAsyncInvocationSupported(cxfExchange)
                    && (continuation = getContinuation(cxfExchange)) != null) {
                    LOG.trace("Calling the Camel async processors.");
                    return asyncInvoke(cxfExchange, continuation);
                } else {
                    LOG.trace("Calling the Camel sync processors.");
                    return syncInvoke(cxfExchange);
                }
            }
            // NOTE this code cannot work with CXF 2.2.x and JMSContinuation
            // as it doesn't break out the interceptor chain when we call it
            private Object asyncInvoke(Exchange cxfExchange, final Continuation continuation) {
                synchronized (continuation) {
                    if (continuation.isNew()) {
                        final org.apache.camel.Exchange camelExchange = prepareCamelExchange(cxfExchange);
                       
                        // Now we don't set up the timeout value
                        LOG.trace("Suspending continuation of exchangeId: {}", camelExchange.getExchangeId());
                       
                        // The continuation could be called before the suspend is called
                        continuation.suspend(cxfEndpoint.getContinuationTimeout());

                        // use the asynchronous API to process the exchange
                        getAsyncProcessor().process(camelExchange, new AsyncCallback() {
                            public void done(boolean doneSync) {
                                // make sure the continuation resume will not be called before the suspend method in other thread
                                synchronized (continuation) {
                                    LOG.trace("Resuming continuation of exchangeId: {}", camelExchange.getExchangeId());
                                    // resume processing after both, sync and async callbacks
                                    continuation.setObject(camelExchange);
                                    continuation.resume();
                                }
                            }
                        });
                       
                    } else if (continuation.isResumed()) {
                        org.apache.camel.Exchange camelExchange = (org.apache.camel.Exchange)continuation.getObject();
                        try {
                            setResponseBack(cxfExchange, camelExchange);
                        } finally {
                            CxfConsumer.this.doneUoW(camelExchange);
                        }

                    }
                }
                return null;
            }
            private Continuation getContinuation(Exchange cxfExchange) {
                ContinuationProvider provider =
                    (ContinuationProvider)cxfExchange.getInMessage().get(ContinuationProvider.class.getName());
                Continuation continuation = provider == null ? null : provider.getContinuation();
                // Make sure we don't return the JMSContinuation, as it doesn't support the Continuation we wants
                // Don't want to introduce the dependency of cxf-rt-transprot-jms here
                if (continuation != null && continuation.getClass().getName().equals("org.apache.cxf.transport.jms.continuations.JMSContinuation")) {
                    return null;
                } else {
                    return continuation;
                }
            }
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.