private void destroyFlowlet() { final TransactionContext txContext = flowletContext.createTransactionContext(); try { txContext.start(); try { LOG.info("Destroying flowlet: " + flowletContext); flowlet.destroy(); LOG.info("Flowlet destroyed: " + flowletContext); } catch (Throwable t) { LOG.error("User code exception. Aborting transaction.", t); txContext.abort(new TransactionFailureException("User code exception. Aborting transaction", t)); // No need to propagate, as it is shutting down. } txContext.finish(); } catch (TransactionFailureException e) { LOG.error("Flowlet throws exception during flowlet destroy: " + flowletContext, e); // No need to propagate, as it is shutting down. } }