Java Code Examples for org.apache.hadoop.service.AbstractService

The following examples show how to use org.apache.hadoop.service.AbstractService. These examples are extracted from open source projects. 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 Project: tez   Source File: VertexImpl.java    License: 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 Project: incubator-tez   Source File: TaskSchedulerEventHandler.java    License: 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 Project: incubator-tez   Source File: TestTaskSchedulerHelpers.java    License: 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 Project: tez   Source File: VertexImpl.java    License: 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 Project: hadoop   Source File: MRAppMaster.java    License: Apache License 2.0 4 votes vote down vote up
protected AbstractService createStagingDirCleaningService() {
  return new StagingDirCleaningService();
}
 
Example 6
Source Project: hadoop   Source File: TestGlobalStateChangeListener.java    License: Apache License 2.0 4 votes vote down vote up
private void register(ServiceStateChangeListener l) {
  AbstractService.registerGlobalListener(l);
}
 
Example 7
Source Project: hadoop   Source File: TestGlobalStateChangeListener.java    License: Apache License 2.0 4 votes vote down vote up
private boolean unregister(ServiceStateChangeListener l) {
  return AbstractService.unregisterGlobalListener(l);
}
 
Example 8
Source Project: hadoop   Source File: TestGlobalStateChangeListener.java    License: 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 Project: big-c   Source File: MRAppMaster.java    License: Apache License 2.0 4 votes vote down vote up
protected AbstractService createStagingDirCleaningService() {
  return new StagingDirCleaningService();
}
 
Example 10
Source Project: big-c   Source File: TestGlobalStateChangeListener.java    License: Apache License 2.0 4 votes vote down vote up
private void register(ServiceStateChangeListener l) {
  AbstractService.registerGlobalListener(l);
}
 
Example 11
Source Project: big-c   Source File: TestGlobalStateChangeListener.java    License: Apache License 2.0 4 votes vote down vote up
private boolean unregister(ServiceStateChangeListener l) {
  return AbstractService.unregisterGlobalListener(l);
}
 
Example 12
Source Project: big-c   Source File: TestGlobalStateChangeListener.java    License: 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 Project: tez   Source File: VertexImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public AbstractService getSpeculator() { return speculator; }
 
Example 14
Source Project: tez   Source File: Vertex.java    License: Apache License 2.0 votes vote down vote up
AbstractService getSpeculator();