@Test public void testJavaExecutorReleasedAfterSuccessExecution() { final JavaExecutor javaExecutor = mock(JavaExecutor.class); JavaExecutionCachedEngine engine = new JavaExecutionCachedEngine() { public JavaExecutor allocateExecutor(Set<String> dependencies) { return javaExecutor; } }; engine.execute("", "", "", null); verify(javaExecutor).release(); }
@Override public Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider) { JavaExecutor executor = allocateExecutor((dependency == null || dependency.isEmpty()) ? Sets.<String>newHashSet() : Sets.newHashSet(dependency)); try { return executor.execute(className, methodName, parametersProvider); } finally { releaseExecutor(executor); } }
JavaExecutionCachedEngine extends ExecutionCachedEngine<JavaExecutor> implements JavaExecutionEngine { @Override public Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider) { JavaExecutor executor = allocateExecutor((dependency == null || dependency.isEmpty()) ? Sets.<String>newHashSet() : Sets.newHashSet(dependency)); try { return executor.execute(className, methodName, parametersProvider); } finally { releaseExecutor(executor); } } }
JavaExecutionCachedEngine extends ExecutionCachedEngine<JavaExecutor> implements JavaExecutionEngine { @Override public Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider) { JavaExecutor executor = allocateExecutor((dependency == null || dependency.isEmpty()) ? Sets.<String>newHashSet() : Sets.newHashSet(dependency)); try { return executor.execute(className, methodName, parametersProvider); } finally { releaseExecutor(executor); } }  }
JavaExecutionCachedEngine extends ExecutionCachedEngine<JavaExecutor> implements JavaExecutionEngine { @Override public Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider) { JavaExecutor executor = allocateExecutor((dependency == null || dependency.isEmpty()) ? Sets.<String>newHashSet() : Sets.newHashSet(dependency)); try { return executor.execute(className, methodName, parametersProvider); } finally { releaseExecutor(executor); } }  @Override Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider); }
JavaExecutionCachedEngine extends ExecutionCachedEngine<JavaExecutor> implements JavaExecutionEngine { @Override public Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider) { JavaExecutor executor = allocateExecutor((dependency == null || dependency.isEmpty()) ? Sets.<String>newHashSet() : Sets.newHashSet(dependency)); try { return executor.execute(className, methodName, parametersProvider); } finally { releaseExecutor(executor); } }  @Override Object execute(String dependency, String className, String methodName, JavaExecutionParametersProvider parametersProvider);  }