org.apache.hadoop.service.AbstractService Java Examples

The following examples show how to use org.apache.hadoop.service.AbstractService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VertexImpl.java    From tez with Apache License 2.0 6 votes vote down vote up
@Override
public void startServices() {
  writeLock.lock();
  try {
    if (!servicesInited.get()) {
      initServices();
    }
    for (AbstractService srvc : services) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("starting service : " + srvc.getName()
            + ", for vertex: " + getName());
      }
      srvc.start();
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #2
Source File: TaskSchedulerEventHandler.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public void serviceStop() {
  synchronized(this) {
    this.stopEventHandling = true;
    if (eventHandlingThread != null)
      eventHandlingThread.interrupt();
  }
  if (taskScheduler != null) {
    ((AbstractService)taskScheduler).stop();
  }
}
 
Example #3
Source File: TestTaskSchedulerHelpers.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public void serviceStart() {
  TaskSchedulerService taskSchedulerReal = createTaskScheduler("host", 0, "",
    appContext);
  // Init the service so that reuse configuration is picked up.
  ((AbstractService)taskSchedulerReal).init(getConfig());
  ((AbstractService)taskSchedulerReal).start();
  taskScheduler = spy(taskSchedulerReal);
}
 
Example #4
Source File: VertexImpl.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public void initServices() {
  if (servicesInited.get()) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Skipping Initing services for vertex because already"
          + " Initialized, name=" + this.vertexName);
    }
    return;
  }
  writeLock.lock();
  try {
    List<AbstractService> servicesToAdd = new ArrayList<>();
    if (isSpeculationEnabled()) {
      // Initialize the speculator
      if (LOG.isDebugEnabled()) {
        LOG.debug(
            "Initing service vertex speculator, name=" + this.vertexName);
      }
      speculator = new LegacySpeculator(vertexConf, getAppContext(), this);
      speculator.init(vertexConf);
      servicesToAdd.add(speculator);
    }
    services = Collections.synchronizedList(servicesToAdd);
    servicesInited.set(true);
  } finally {
    writeLock.unlock();
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Initing service vertex, name=" + this.vertexName);
  }
}
 
Example #5
Source File: MRAppMaster.java    From hadoop with Apache License 2.0 4 votes vote down vote up
protected AbstractService createStagingDirCleaningService() {
  return new StagingDirCleaningService();
}
 
Example #6
Source File: TestGlobalStateChangeListener.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private void register(ServiceStateChangeListener l) {
  AbstractService.registerGlobalListener(l);
}
 
Example #7
Source File: TestGlobalStateChangeListener.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private boolean unregister(ServiceStateChangeListener l) {
  return AbstractService.unregisterGlobalListener(l);
}
 
Example #8
Source File: TestGlobalStateChangeListener.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * After every test case reset the list of global listeners.
 */
@After
public void cleanup() {
  AbstractService.resetGlobalListeners();
}
 
Example #9
Source File: MRAppMaster.java    From big-c with Apache License 2.0 4 votes vote down vote up
protected AbstractService createStagingDirCleaningService() {
  return new StagingDirCleaningService();
}
 
Example #10
Source File: TestGlobalStateChangeListener.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void register(ServiceStateChangeListener l) {
  AbstractService.registerGlobalListener(l);
}
 
Example #11
Source File: TestGlobalStateChangeListener.java    From big-c with Apache License 2.0 4 votes vote down vote up
private boolean unregister(ServiceStateChangeListener l) {
  return AbstractService.unregisterGlobalListener(l);
}
 
Example #12
Source File: TestGlobalStateChangeListener.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * After every test case reset the list of global listeners.
 */
@After
public void cleanup() {
  AbstractService.resetGlobalListeners();
}
 
Example #13
Source File: VertexImpl.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public AbstractService getSpeculator() { return speculator; }
 
Example #14
Source File: Vertex.java    From tez with Apache License 2.0 votes vote down vote up
AbstractService getSpeculator();