Package org.jenkinsci.plugins.workflow.steps

Examples of org.jenkinsci.plugins.workflow.steps.StepExecution


        Step s;
        boolean sync;
        try {
            d.checkContextAvailability(context);
            s = d.newInstance(ps.namedArgs);
            StepExecution e = s.start(context);
            thread.setStep(e);
            sync = e.start();
        } catch (Exception e) {
            if (e instanceof MissingContextVariableException)
                reportMissingContextVariableException(context, (MissingContextVariableException)e);
            context.onFailure(e);
            s = null;
View Full Code Here


    @Override
    public synchronized Collection<StepExecution> getCurrentExecutions() {
        if (thread==null)   return Collections.emptyList();

        StepExecution s = thread.getStep();
        if (s!=null)        return Collections.singleton(s);
        else                return Collections.emptyList();
    }
View Full Code Here

        if (t!=null) {
            t.getExecution().runInCpsVmThread(new FutureCallback<CpsThreadGroup>() {
                @Override
                public void onSuccess(CpsThreadGroup g) {
                    StepExecution s = t.getStep()// this is the part that should run in CpsVmThread
                    if (s == null) {
                        // TODO: if it's not running inside a StepExecution, we need to set an interrupt flag
                        // and interrupt at an earliest convenience
                        return;
                    }

                    try {
                        s.stop(stopped);
                    } catch (Exception e) {
                        LOGGER.log(Level.WARNING, "Failed to stop " + s, e);
                    }
                }
View Full Code Here

        return start;
    }

    @Override public FlowNode run(StepContext context, String nodeId, FlowExecution exec, FlowNode prior) {
        try {
            StepExecution e = step.start(context);
            // TODO: e should be stored somewhere
            if (e.start()) {
                // TODO assert that context has gotten a return value
            }
        } catch (Exception x) {
            context.onFailure(x);
        }
View Full Code Here

        k = id + "/" + number;
    }

    /** Starts running and waits for {@link #success} or {@link #failure} to be called, if they have not been already. */
    @Override public StepExecution start(StepContext context) throws Exception {
        return new StepExecution(context) {
            @Override
            public boolean start() throws Exception {
                if (returnValues.containsKey(k)) {
                    System.err.println("Immediately running " + k);
                    getContext().onSuccess(returnValues.get(k));
View Full Code Here

        return step;
    }

    @Override public FlowNode run(StepContext context, String nodeId, FlowExecution exec, FlowNode prior) {
        try {
            StepExecution e = step.start(context);
            // TODO: e should be stored somewhere
            if (e.start()) {
                // TODO assert that context has gotten a return value
            }
        } catch (Exception x) {
            context.onFailure(x);
        }
View Full Code Here

            public void onSuccess(CpsThreadGroup g) {
                // to exclude outer StepExecutions, first build a map by FlowHead
                // younger threads with their StepExecutions will overshadow old threads, leaving inner-most threads alone.
                Map<FlowHead,StepExecution> m = new HashMap<FlowHead, StepExecution>();
                for (CpsThread t : g.threads.values()) {
                    StepExecution e = t.getStep();
                    if (e!=null)
                        m.put(t.head,e);
                }

                r.set(ImmutableList.copyOf(m.values()));
View Full Code Here

        return state;
    }

    @Override public StepExecution start(final StepContext context) throws Exception {
        this.context = context;
        return new StepExecution(context) {
            @Override
            public boolean start() throws Exception {
                moveFrom(State.INIT);
                return false;
            }
View Full Code Here

TOP

Related Classes of org.jenkinsci.plugins.workflow.steps.StepExecution

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.