@Test public void testPythonExecutorReleasedAfterSuccessExecution() { final PythonExecutor pythonExecutor = mock(PythonExecutor.class); PythonExecutionCachedEngine engine = new PythonExecutionCachedEngine() { public PythonExecutor allocateExecutor(Set<String> dependencies) { return pythonExecutor; } }; engine.exec(Collections.<String>emptySet(),"", new HashMap<String, Serializable>()); verify(pythonExecutor).release(); }
@Override public PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars) { PythonExecutor executor = allocateExecutor(dependencies); try { return executor.exec(script, vars); } finally { releaseExecutor(executor); } }
PythonExecutionCachedEngine extends ExecutionCachedEngine<PythonExecutor> implements PythonExecutionEngine { @Override public PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars) { PythonExecutor executor = allocateExecutor(dependencies); try { return executor.exec(script, vars); } finally { releaseExecutor(executor); } } }
PythonExecutionCachedEngine extends ExecutionCachedEngine<PythonExecutor> implements PythonExecutionEngine { @Override public PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars) { PythonExecutor executor = allocateExecutor(dependencies); try { return executor.exec(script, vars); } finally { releaseExecutor(executor); } }  }
PythonExecutionCachedEngine extends ExecutionCachedEngine<PythonExecutor> implements PythonExecutionEngine { @Override public PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars) { PythonExecutor executor = allocateExecutor(dependencies); try { return executor.exec(script, vars); } finally { releaseExecutor(executor); } }  @Override PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars); @Override PythonEvaluationResult eval(String prepareEnvironmentScript, String script, Map<String, Serializable> vars); }
PythonExecutionCachedEngine extends ExecutionCachedEngine<PythonExecutor> implements PythonExecutionEngine { @Override public PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars) { PythonExecutor executor = allocateExecutor(dependencies); try { return executor.exec(script, vars); } finally { releaseExecutor(executor); } }  @Override PythonExecutionResult exec(Set<String> dependencies, String script, Map<String, Serializable> vars); @Override PythonEvaluationResult eval(String prepareEnvironmentScript, String script, Map<String, Serializable> vars);  }