private void cleanup(StepContext context) { try { disposer.tearDown( context.get(Run.class), context.get(FilePath.class), context.get(Launcher.class), context.get(TaskListener.class)); } catch (Exception x) { context.onFailure(x); } }
@Override public void onFailure(StepContext context, Throwable t) { cleanup(context); context.onFailure(t); }
@Override public void onSuccess(StepContext context, Object result) { cleanup(context); context.onSuccess(result); }