/** * Stop a service. * <p/>Do nothing if the service is null or not * in a state in which it can be/needs to be stopped. * <p/> * The service state is checked <i>before</i> the operation begins. * This process is <i>not</i> thread safe. * @param service a service or null */ public static void stop(Service service) { if (service != null) { service.stop(); } }
/** * Shutdown callback: stop the service and set an atomic boolean * if it stopped within the shutdown time. */ @Override public void run() { if (service != null) { service.stop(); serviceWasShutdown.set( service.waitForServiceToStop(shutdownTimeMillis)); } else { serviceWasShutdown.set(true); } }
/** * Shutdown operation. * <p> * Subclasses may extend it, but it is primarily * made available for testing. * @return true if the service was stopped and no exception was raised. */ protected boolean shutdown() { Service service; boolean result = false; synchronized (this) { service = serviceRef.get(); serviceRef.clear(); } if (service != null) { try { // Stop the Service service.stop(); result = true; } catch (Throwable t) { LOG.info("Error stopping {}", service.getName(), t); } } return result; } }
} finally { service.stop();
/** * Stop a service. * <p/>Do nothing if the service is null or not * in a state in which it can be/needs to be stopped. * <p/> * The service state is checked <i>before</i> the operation begins. * This process is <i>not</i> thread safe. * @param service a service or null */ public static void stop(Service service) { if (service != null) { service.stop(); } }
@Override protected void serviceStop() throws Exception { //stop current service. //this triggers a callback that is caught and ignored Service current = activeService; previousService = current; activeService = null; if (current != null) { current.stop(); } }
/** * Stop a service. * <p/>Do nothing if the service is null or not * in a state in which it can be/needs to be stopped. * <p/> * The service state is checked <i>before</i> the operation begins. * This process is <i>not</i> thread safe. * @param service a service or null */ public static void stop(Service service) { if (service != null) { service.stop(); } }
@Override protected void serviceStop() throws Exception { //stop current service. //this triggers a callback that is caught and ignored Service current = activeService; previousService = current; activeService = null; if (current != null) { current.stop(); } }
/** * Stop a service. * <p/>Do nothing if the service is null or not * in a state in which it can be/needs to be stopped. * <p/> * The service state is checked <i>before</i> the operation begins. * This process is <i>not</i> thread safe. * @param service a service or null */ public static void stop(Service service) { if (service != null) { service.stop(); } }
/** * Stop a service. * <p/>Do nothing if the service is null or not * in a state in which it can be/needs to be stopped. * <p/> * The service state is checked <i>before</i> the operation begins. * This process is <i>not</i> thread safe. * @param service a service or null */ public static void stop(Service service) { if (service != null) { service.stop(); } }
@Override public void run() { try { action.run(); } catch (Exception e) { exception = e; } owner.stop(); } }
@Override public void run() { try { action.run(); } catch (Exception e) { exception = e; } owner.stop(); } }
@Override public void serviceStop() throws Exception { try { synchronized (serviceMap) { for (Service service : serviceMap.values()) { if (service.getServiceState() == Service.STATE.STARTED) { service.unregisterServiceListener(this); service.stop(); } } serviceMap.clear(); serviceMetaData.clear(); } } finally { super.serviceStop(); } }
@After public void tearDown() { pullServerService.stop(); }
private void resetDispatcher() { Dispatcher dispatcher = setupDispatcher(); ((Service)dispatcher).init(this.conf); ((Service)dispatcher).start(); removeService((Service)rmDispatcher); // Need to stop previous rmDispatcher before assigning new dispatcher // otherwise causes "AsyncDispatcher event handler" thread leak ((Service) rmDispatcher).stop(); rmDispatcher = dispatcher; addIfService(rmDispatcher); rmContext.setDispatcher(rmDispatcher); }
private void resetDispatcher() { Dispatcher dispatcher = setupDispatcher(); ((Service)dispatcher).init(this.conf); ((Service)dispatcher).start(); removeService((Service)rmDispatcher); // Need to stop previous rmDispatcher before assigning new dispatcher // otherwise causes "AsyncDispatcher event handler" thread leak ((Service) rmDispatcher).stop(); rmDispatcher = dispatcher; addIfService(rmDispatcher); rmContext.setDispatcher(rmDispatcher); }
@Test public void testSingleChild() throws Throwable { Service parent = startService(new MockService()); parent.stop(); }
@After public void tearDown() { setAppEventType(RMAppEventType.KILL); ((Service)rmContext.getDispatcher()).stop(); }
@Test public void testSingleChild() throws Throwable { Service parent = startService(new MockService()); parent.stop(); }
@After public void tearDown() { setAppEventType(RMAppEventType.KILL); ((Service)rmContext.getDispatcher()).stop(); UserGroupInformation.reset(); }