@Test(expected = Exception.class) public void close_throws_if_service_doesnt_shutdown() throws Exception { when(service.awaitTermination(anyLong(), any())).thenReturn(false); new Sender(onrampClient, contextManager, 1L, service).close(); }
@Override public void close() throws Exception { service.shutdown(); if (!service.awaitTermination(5, TimeUnit.MINUTES)) { throw new Exception("Timed out waiting for sender service to terminate"); } log.info("Shutdown sender"); }
Sender implements AutoCloseable { @Override public void close() throws Exception { service.shutdown(); if (!service.awaitTermination(5, TimeUnit.MINUTES)) { throw new Exception("Timed out waiting for sender service to terminate"); } log.info("Shutdown sender"); } }
Sender implements AutoCloseable { @Override public void close() throws Exception { service.shutdown(); if (!service.awaitTermination(5, TimeUnit.MINUTES)) { throw new Exception("Timed out waiting for sender service to terminate"); } log.info("Shutdown sender"); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); }
Sender implements AutoCloseable { @Override public void close() throws Exception { service.shutdown(); if (!service.awaitTermination(5, TimeUnit.MINUTES)) { throw new Exception("Timed out waiting for sender service to terminate"); } log.info("Shutdown sender"); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); void start(); void worker(); @Override void close(); }
Sender implements AutoCloseable { @Override public void close() throws Exception { service.shutdown(); if (!service.awaitTermination(5, TimeUnit.MINUTES)) { throw new Exception("Timed out waiting for sender service to terminate"); } log.info("Shutdown sender"); } @Autowired  Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      @Value("${messageHz}") long messageRate);   Sender(
      AsyncRoadClient<TestMessage> onrampClient,
      TestMessageContextManager contextManager,
      long messageRate,
      ScheduledExecutorService service); void start(); void worker(); @Override void close();  }