public ConfigDiff guess(ExecSession exec, final ConfigSource config) { try { return Exec.doWith(exec, new ExecAction<ConfigDiff>() { public ConfigDiff run() { try (SetCurrentThreadName dontCare = new SetCurrentThreadName("guess")) { return doGuess(config); } } }); } catch (ExecutionException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } throw new RuntimeException(ex.getCause()); } }
public ExecutionResult run(ExecSession exec, final ConfigSource config) { try { return Exec.doWith(exec, new ExecAction<ExecutionResult>() { public ExecutionResult run() { try (SetCurrentThreadName dontCare = new SetCurrentThreadName("transaction")) { return doRun(config); } } }); } catch (ExecutionException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } throw new RuntimeException(ex.getCause()); } }
public PreviewResult preview(ExecSession exec, final ConfigSource config) { try { return Exec.doWith(exec.forPreview(), new ExecAction<PreviewResult>() { public PreviewResult run() { try (SetCurrentThreadName dontCare = new SetCurrentThreadName("preview")) { return doPreview(config); } } }); } catch (Exception ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } throw new RuntimeException(ex.getCause()); } }
public void cleanup(final ConfigSource config, final ResumeState resume) { try { ExecSession exec = ExecSession.builder(injector).fromExecConfig(resume.getExecSessionConfigSource()).build(); Exec.doWith(exec, new ExecAction<Void>() { public Void run() { try (SetCurrentThreadName dontCare = new SetCurrentThreadName("cleanup")) { doCleanup(config, resume); return null; } } }); exec.cleanup(); } catch (ExecutionException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } throw new RuntimeException(ex.getCause()); } }
public ExecutionResult resume(final ConfigSource config, final ResumeState resume) { try { ExecSession exec = ExecSession.builder(injector).fromExecConfig(resume.getExecSessionConfigSource()).build(); ExecutionResult result = Exec.doWith(exec, new ExecAction<ExecutionResult>() { public ExecutionResult run() { try (SetCurrentThreadName dontCare = new SetCurrentThreadName("resume")) { return doResume(config, resume); } } }); exec.cleanup(); return result; } catch (ExecutionException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } if (ex.getCause() instanceof Error) { throw (Error) ex.getCause(); } throw new RuntimeException(ex.getCause()); } }
public void evaluate() throws Throwable { try { Exec.doWith(exec, new ExecAction<Void>() { public Void run() { try { superStatement.evaluate(); } catch (Throwable ex) { throw new RuntimeExecutionException(ex); } return null; } }); } catch (RuntimeException ex) { throw ex.getCause(); } finally { exec.cleanup(); } } };