Search in sources :

Example 1 with Instrumentable

use of org.apache.oozie.util.Instrumentable in project oozie by apache.

the class Services method init.

/**
 * Initialize all services define in the {@link #CONF_SERVICE_CLASSES} configuration property.
 *
 * @throws ServiceException thrown if any of the services could not initialize.
 */
public void init() throws ServiceException {
    XLog log = new XLog(LogFactory.getLog(getClass()));
    log.trace("Initializing");
    SERVICES = this;
    try {
        loadServices();
    } catch (RuntimeException rex) {
        XLog.getLog(getClass()).fatal(rex.getMessage(), rex);
        throw rex;
    } catch (ServiceException ex) {
        XLog.getLog(getClass()).fatal(ex.getMessage(), ex);
        SERVICES = null;
        throw ex;
    }
    InstrumentationService instrService = get(InstrumentationService.class);
    if (instrService != null) {
        Instrumentation instr = instrService.get();
        for (Service service : services.values()) {
            if (service instanceof Instrumentable) {
                ((Instrumentable) service).instrument(instr);
            }
        }
        instr.addVariable("oozie", "version", new Instrumentation.Variable<String>() {

            @Override
            public String getValue() {
                return BuildInfo.getBuildInfo().getProperty(BuildInfo.BUILD_VERSION);
            }
        });
        instr.addVariable("oozie", "mode", new Instrumentation.Variable<String>() {

            @Override
            public String getValue() {
                return getSystemMode().toString();
            }
        });
    }
    log.info("Initialized");
    log.info("Running with JARs for Hadoop version [{0}]", VersionInfo.getVersion());
    log.info("Oozie System ID [{0}] started!", getSystemId());
}
Also used : XLog(org.apache.oozie.util.XLog) Instrumentation(org.apache.oozie.util.Instrumentation) Instrumentable(org.apache.oozie.util.Instrumentable)

Aggregations

Instrumentable (org.apache.oozie.util.Instrumentable)1 Instrumentation (org.apache.oozie.util.Instrumentation)1 XLog (org.apache.oozie.util.XLog)1