protected void serviceInit(Configuration conf) throws Exception { List<Service> services = getServices(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": initing services, size=" + services.size()); } for (Service service : services) { service.init(conf); } super.serviceInit(conf); }
service.init(configuration);
void initServices(Configuration conf) { for (ServiceWithDependency sd : services.values()) { if (LOG.isDebugEnabled()) { LOG.debug("Initing service : " + sd.service); } sd.service.init(conf); } }
protected void serviceInit(Configuration conf) throws Exception { List<Service> services = getServices(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": initing services, size=" + services.size()); } for (Service service : services) { service.init(conf); } super.serviceInit(conf); }
protected void serviceInit(Configuration conf) throws Exception { List<Service> services = getServices(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": initing services, size=" + services.size()); } for (Service service : services) { service.init(conf); } super.serviceInit(conf); }
protected void serviceInit(Configuration conf) throws Exception { List<Service> services = getServices(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": initing services, size=" + services.size()); } for (Service service : services) { service.init(conf); } super.serviceInit(conf); }
/** * Initialize a newly created service then add it. * Because the service is not started, this MUST be done before * the AM itself starts, or it is explicitly added after * @param service the service to init */ public Service initAndAddService(Service service) { service.init(getConfig()); addService(service); return service; }
/** * Initialize a newly created service then add it. * Because the service is not started, this MUST be done before * the AM itself starts, or it is explicitly added after * @param service the service to init */ public Service initAndAddService(Service service) { service.init(getConfig()); addService(service); return service; }
/** * Init and start a service * @param svc the service * @return the service */ protected <S extends Service> S run(S svc) { svc.init(new Configuration()); svc.start(); return svc; }
/** * Init and start a service * @param svc the service * @return the service */ protected <S extends Service> S run(S svc) { svc.init(new Configuration()); svc.start(); return svc; }
protected void serviceInit(Configuration conf) throws Exception { List<Service> services = getServices(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": initing services, size=" + services.size()); } for (Service service : services) { service.init(conf); } super.serviceInit(conf); }
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); }
@Override protected void serviceStart() throws Exception { if (job.isUber()) { MRApps.setupDistributedCacheLocal(getConfig()); this.containerAllocator = new LocalContainerAllocator( this.clientService, this.context, nmHost, nmPort, nmHttpPort , containerID); } else { this.containerAllocator = new RMContainerAllocator( this.clientService, this.context); } ((Service)this.containerAllocator).init(getConfig()); ((Service)this.containerAllocator).start(); super.serviceStart(); }
@Test public void testStopInInitService() throws Throwable { Service service = new StopInInitService(); BreakableStateChangeListener listener = new BreakableStateChangeListener(); service.registerServiceListener(listener); service.init(new Configuration()); assertServiceInState(service, Service.STATE.STOPPED); assertEventCount(listener, 1); }
@Test public void testStartInInitService() throws Throwable { Service service = new StartInInitService(); BreakableStateChangeListener listener = new BreakableStateChangeListener(); service.registerServiceListener(listener); service.init(new Configuration()); assertServiceInState(service, Service.STATE.STARTED); assertEventCount(listener, 1); }
@Test public void testStopInInitService() throws Throwable { Service service = new StopInInitService(); BreakableStateChangeListener listener = new BreakableStateChangeListener(); service.registerServiceListener(listener); service.init(new Configuration()); assertServiceInState(service, Service.STATE.STOPPED); assertEventCount(listener, 1); }
@Test public void testStartInInitService() throws Throwable { Service service = new StartInInitService(); BreakableStateChangeListener listener = new BreakableStateChangeListener(); service.registerServiceListener(listener); service.init(new Configuration()); assertServiceInState(service, Service.STATE.STARTED); assertEventCount(listener, 1); }
protected void setupDispatcher(RMContext rmContext, Configuration conf) { TestDispatcher testDispatcher = new TestDispatcher(); TestAppManagerDispatcher testAppManagerDispatcher = new TestAppManagerDispatcher(); rmContext.getDispatcher().register(RMAppEventType.class, testDispatcher); rmContext.getDispatcher().register(RMAppManagerEventType.class, testAppManagerDispatcher); ((Service)rmContext.getDispatcher()).init(conf); ((Service)rmContext.getDispatcher()).start(); Assert.assertEquals("app event type is wrong before", RMAppEventType.KILL, appEventType); }
protected void setupDispatcher(RMContext rmContext, Configuration conf) { TestDispatcher testDispatcher = new TestDispatcher(); TestAppManagerDispatcher testAppManagerDispatcher = new TestAppManagerDispatcher(); rmContext.getDispatcher().register(RMAppEventType.class, testDispatcher); rmContext.getDispatcher().register(RMAppManagerEventType.class, testAppManagerDispatcher); ((Service)rmContext.getDispatcher()).init(conf); ((Service)rmContext.getDispatcher()).start(); Assert.assertEquals("app event type is wrong before", RMAppEventType.KILL, appEventType); }