public boolean isPaused() { if (programPromise.isDone()) { try { return programPromise.get().isPaused(); } catch (ExecutionException | InterruptedException x) { // not supposed to happen LOGGER.log(Level.WARNING, null, x); } } return false; }
public void onSuccess(Unmarshaller u) { pickleFutures = null; try { CpsFlowExecution old = PROGRAM_STATE_SERIALIZATION.get(); PROGRAM_STATE_SERIALIZATION.set(CpsFlowExecution.this); try { CpsThreadGroup g = (CpsThreadGroup) u.readObject(); result.set(g); try { if (g.isPaused()) { owner.getListener().getLogger().println("Still paused"); } else { owner.getListener().getLogger().println("Ready to run at " + new Date()); // In case we last paused execution due to Jenkins.isQuietingDown, make sure we do something after we restart. g.scheduleRun(); } } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } } catch (Throwable t) { onFailure(t); } finally { PROGRAM_STATE_SERIALIZATION.set(old); } } finally { r.close(); } }