RangerTransactionService { @PreDestroy public void destroy() { try { LOG.info("attempt to shutdown RangerTransactionService"); scheduler.shutdown(); scheduler.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("RangerTransactionService tasks interrupted"); } finally { if (!scheduler.isTerminated()) { LOG.info("cancel non-finished RangerTransactionService tasks"); } scheduler.shutdownNow(); LOG.info("RangerTransactionService shutdown finished"); } }  @PostConstruct void init(); @PreDestroy void destroy(); void scheduleToExecuteInOwnTransaction(final Runnable task, final long delayInMillis);  }
@Test public void test2Destroy() { rangerTransactionService.destroy(); }