@Test public void testShutdownOnClose() throws IOException { Injector i = Guice.createInjector(); Closer closer = i.getInstance(Closer.class); ListeningExecutorService executor = createMock(ListeningExecutorService.class); ExecutorServiceModule.shutdownOnClose(executor, closer); expect(executor.shutdownNow()).andReturn(ImmutableList.<Runnable> of()).atLeastOnce(); replay(executor); closer.close(); verify(executor); }
static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; }
ExecutorServiceModule extends AbstractModule { static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; } }
ExecutorServiceModule extends AbstractModule { static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; } ExecutorServiceModule(); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor,
         ExecutorService ioExecutor); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
         ListeningExecutorService ioExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor); }
ExecutorServiceModule extends AbstractModule { static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; } ExecutorServiceModule(); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor,
         ExecutorService ioExecutor); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
         ListeningExecutorService ioExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor); static SimpleTimeLimiter createSimpleTimeLimiter(ExecutorService executorService); }
ExecutorServiceModule extends AbstractModule { static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) { closer.addToClose(new ShutdownExecutorOnClose(service)); return service; } ExecutorServiceModule(); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor,
         ExecutorService ioExecutor); @Deprecated  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
         ListeningExecutorService ioExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor);  ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor); static SimpleTimeLimiter createSimpleTimeLimiter(ExecutorService executorService);  }