Package com.cloudbees.groovy.cps

Examples of com.cloudbees.groovy.cps.Outcome


        }
    }

    @Override
    public void onFailure(Throwable t) {
        for (FutureCallback<Object> c : grabCallbacks(new Outcome(null,t))) {
            c.onFailure(t);
        }
    }
View Full Code Here


                // beyond this point, StepContext can receive a result at any time and
                // that would result in a call to scheduleNextChunk(). So we the call to
                // switchToAsyncMode to happen inside 'synchronized(lock)', so that
                // the 'executing' variable gets set to null before the scheduleNextChunk call starts going.

                return suspendWith(new Outcome(context,null));
            }
        }
View Full Code Here

                this.name = name;
            }

            @Override
            public void onSuccess(Object result) {
                handler.outcomes.put(name, new Outcome(result, null));
                checkAllDone();
            }
View Full Code Here

                checkAllDone();
            }

            @Override
            public void onFailure(Throwable t) {
                handler.outcomes.put(name, new Outcome(null, t));
                checkAllDone();
            }
View Full Code Here

            private void checkAllDone() {
                Map<String,Object> success = new HashMap<String, Object>();
                Entry<String,Outcome> failure = null;
                for (Entry<String,Outcome> e : handler.outcomes.entrySet()) {
                    Outcome o = e.getValue();

                    if (o==null)
                        return; // some of the results are not yet ready
                    if (o.isFailure()) {
                        failure= e;
                    } else {
                        success.put(e.getKey(), o.getNormal());
                    }
                }

                // all done
                if (failure!=null) {
View Full Code Here

        final SettableFuture<CpsThreadGroup> f = SettableFuture.create();
        g.runner.submit(new Runnable() {
            @Override
            public void run() {
                CpsThread t = g.addThread(new Continuable(s,createInitialEnv()),h,null);
                t.resume(new Outcome(null, null));
                f.set(g);
            }

            /**
             * Environment to start executing the script in.
View Full Code Here

                CpsThread t = g.addThread(
                        new Continuable(new ThrowBlock(new ConstantBlock(
                            new IOException("Failed to load persisted workflow state", problem)))),
                        head_, null
                );
                t.resume(new Outcome(null,null));
            }
            @Override public void onFailure(Throwable t) {
                LOGGER.log(Level.WARNING, null, t);
            }
        });
View Full Code Here

    /**
     * Runs one step in this thread and returns a new state.
     */
    /*package*/ GreenThreadState tick(Object o) {
        return resumeFrom(new Outcome(o,null));
    }
View Full Code Here

    /**
     * Runs one step in this thread and returns a new state.
     */
    /*package*/ GreenThreadState tick(Object o) {
        return resumeFrom(new Outcome(o,null));
    }
View Full Code Here

     *
     * We'll build an updated {@link GreenWorld} then return it.
     */
    Next update(GreenThreadState g) {
        GreenWorld d = this.with(g);
        Outcome y = g.n.yield;

        if (y==null) {
            // no yield. rotate to next thread and keep going
            return d.withNewCur().asNext(null);
        }

        if (y.getNormal() instanceof ThreadTask) {
            // a task that needs to update/access the state
            ThreadTask task = (ThreadTask)y.getNormal();

            Result r = task.eval(d);
            d = r.w;
            if (r.suspend// yield the value, then come back to the current thread later
                return d.asNext(r.value);
View Full Code Here

TOP

Related Classes of com.cloudbees.groovy.cps.Outcome

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.