/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
/** * Initiates service {@linkplain Service#stopAsync shutdown} if necessary on all the services * being managed. * * @return this */ @CanIgnoreReturnValue public ServiceManager stopAsync() { for (Service service : services) { service.stopAsync(); } return this; }
/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
/** * Close {@link Closeable}s and shutdown {@link Service}s. */ public static void shutdownObject(Object obj, Logger log) { if (obj instanceof Service) { ((Service) obj).stopAsync(); } else if (obj instanceof Closeable) { try { ((Closeable) obj).close(); } catch (IOException ioe) { log.error("Failed to close {}.", obj); } } } }
/** * Initiates service {@linkplain Service#stopAsync shutdown} if necessary on all the services * being managed. * * @return this */ @CanIgnoreReturnValue public ServiceManager stopAsync() { for (Service service : services) { service.stopAsync(); } return this; }
/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
private void stopQuietly(final Service service) { if (service == null) { return; } try { service.stopAsync().awaitTerminated(); } catch (Exception ignore) { // ignored } }
/** @since 15.0 */ @CanIgnoreReturnValue @Override public final Service stopAsync() { delegate.stopAsync(); return this; }
@Override public void doStop() { if (generatorService == null || !generatorService.isRunning()) { log.error("Cannot stop generator transport, it isn't running."); return; } log.debug("Stopping generator transport service {}", generatorService); generatorService.stopAsync().awaitTerminated(); generatorService = null; }
/** * Initiates service {@linkplain Service#stopAsync shutdown} if necessary on all the services * being managed. * * @return this */ @CanIgnoreReturnValue public ServiceManager stopAsync() { for (Service service : services) { service.stopAsync(); } return this; }
@Override protected void shutDown() throws Exception { if (this.specConsumer instanceof Service) { ((Service) this.specConsumer).stopAsync().awaitTerminated(this.stopTimeoutSeconds, TimeUnit.SECONDS); } ExecutorsUtils.shutdownExecutorService(this.fetchJobSpecExecutor, Optional.of(LOGGER)); } }
/** * Stop the application launcher then any services that were started outside of the application launcher */ private void stopAppLauncherAndServices() { try { this.applicationLauncher.stop(); } catch (ApplicationException ae) { LOGGER.error("Error while stopping Gobblin Cluster application launcher", ae); } if (this.jobCatalog instanceof Service) { ((Service) this.jobCatalog).stopAsync().awaitTerminated(); } }
@Override public void failure(Service service) { super.failure(service); LOG.error(String.format("Service %s has failed.", service.getClass().getSimpleName()), service.failureCause()); try { service.stopAsync(); ServiceBasedAppLauncher.this.stop(); } catch (ApplicationException ae) { LOG.error("Could not shutdown services gracefully. This may cause the application to hang."); } } });
public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException { final CyclicBarrier inGetNextSchedule = new CyclicBarrier(2); // This will flakily deadlock, so run it multiple times to increase the flake likelihood for (int i = 0; i < 1000; i++) { Service service = new AbstractScheduledService() { @Override protected void runOneIteration() {} @Override protected Scheduler scheduler() { return new CustomScheduler() { @Override protected Schedule getNextSchedule() throws Exception { if (state() != State.STARTING) { inGetNextSchedule.await(); Thread.yield(); throw new RuntimeException("boom"); } return new Schedule(0, TimeUnit.NANOSECONDS); } }; } }; service.startAsync().awaitRunning(); inGetNextSchedule.await(); service.stopAsync(); } }
service.stopAsync(); } catch (Exception e) { log.error("Uncaught exception", e);
stampedeService.stopAsync(); stampedeService.awaitTerminated(); }));
/** * Initiates service {@linkplain Service#stopAsync shutdown} if necessary on all the services * being managed. * * @return this */ public ServiceManager stopAsync() { for (Service service : services) { service.stopAsync(); } return this; }
@Override public void doStop() { if (generatorService == null || !generatorService.isRunning()) { log.error("Cannot stop generator transport, it isn't running."); return; } log.debug("Stopping generator transport service {}", generatorService); generatorService.stopAsync().awaitTerminated(); generatorService = null; }