Example usage for org.apache.hadoop.service Service getName

List of usage examples for org.apache.hadoop.service Service getName

Introduction

In this page you can find the example usage for org.apache.hadoop.service Service getName.

Prototype

String getName();

Source Link

Document

Get the name of this service.

Usage

From source file:MRAppMaster.CompositeService.java

License:Apache License

/**
 * Add the passed {@link Service} to the list of services managed by this
 * {@link CompositeService}//from  ww w  .ja  v  a2s  .c o m
 * @param service the {@link Service} to be added
 */
protected void addService(Service service) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Adding service " + service.getName());
    }
    synchronized (serviceList) {
        serviceList.add(service);
    }
}

From source file:org.apache.hoya.yarn.service.SequenceService.java

License:Apache License

/**
 * Add the passed {@link Service} to the list of services managed by this
 * {@link SequenceService}/* w  ww  . ja  v  a 2s .  c  o m*/
 * @param service the {@link Service} to be added
 */
@Override //Parent
public synchronized void addService(Service service) {
    log.debug("Adding service {} ", service.getName());
    synchronized (serviceList) {
        serviceList.add(service);
    }
}

From source file:org.apache.slider.core.main.ServiceLauncher.java

License:Apache License

/**
 * Get the service name via {@link Service#getName()}.
 * If the service is not instantiated, the classname is returned instead.
 * @return the service name/*from   www  .  j a  v a  2 s . co  m*/
 */
public String getServiceName() {
    Service s = service;
    String name = null;
    if (s != null) {
        try {
            name = s.getName();
        } catch (Exception ignored) {
            // ignored
        }
    }
    if (name != null) {
        return "service " + name;
    } else {
        return "service classname " + serviceClassName;
    }
}

From source file:org.apache.slider.core.main.ServiceShutdownHook.java

License:Apache License

@Override
public void run() {
    Service service;
    synchronized (this) {
        service = serviceRef.get();//  ww  w . jav a  2s.com
        serviceRef.clear();
    }
    if (service == null) {
        return;
    }
    try {
        // Stop the  Service
        service.stop();
    } catch (Throwable t) {
        LOG.info("Error stopping {}: {}", service.getName(), t);
    }
}

From source file:org.apache.slider.server.services.utility.EndOfServiceWaiter.java

License:Apache License

/**
 * Wait for a service; use the service name as this instance's name
 * @param service service/*ww  w .  ja  va 2s  .c  o m*/
 */
public EndOfServiceWaiter(Service service) {
    this(service.getName(), service);
}

From source file:org.apache.slider.server.services.workflow.WorkflowSequenceService.java

License:Apache License

/**
 * Add the passed {@link Service} to the list of services managed by this
 * {@link WorkflowSequenceService}// ww w  .  ja  v a  2 s.  c  om
 * @param service the {@link Service} to be added
 */
@Override
public synchronized void addService(Service service) {
    Preconditions.checkArgument(service != null, "null service argument");
    LOG.debug("Adding service {} ", service.getName());
    synchronized (serviceList) {
        serviceList.add(service);
    }
}

From source file:org.apache.slider.server.services.workflow.WorkflowServiceTestBase.java

License:Apache License

protected void assertInState(Service service, Service.STATE expected) {
    Service.STATE actual = service.getServiceState();
    if (actual != expected) {
        fail("Service " + service.getName() + " in state " + actual + " -expected " + expected);
    }//from ww w.  j a v  a  2s.co  m
}

From source file:org.apache.tez.dag.app.DAGAppMaster.java

License:Apache License

void stopServices() {
    // stop in reverse order of start
    List<Service> serviceList = new ArrayList<Service>(services.size());
    for (ServiceWithDependency sd : services.values()) {
        serviceList.add(sd.service);//  w ww .  j av  a  2  s.  co m
    }
    Exception firstException = null;
    for (int i = services.size() - 1; i >= 0; i--) {
        Service service = serviceList.get(i);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Stopping service : " + service);
        }
        Exception ex = ServiceOperations.stopQuietly(LOG, service);
        if (ex != null && firstException == null) {
            LOG.warn("Failed to stop service, name=" + service.getName(), ex);
            firstException = ex;
        }
    }
    //after stopping all services, rethrow the first exception raised
    if (firstException != null) {
        throw ServiceStateException.convert(firstException);
    }
}