Ejemplo n.º 1
0
 /**
  * Create a services.
  *
  * <p>The built in services are initialized.
  *
  * @throws ServiceException thrown if any of the built in services could not initialize.
  */
 public Services() throws ServiceException {
   if (SERVICES != null) {
     XLog log = XLog.getLog(getClass());
     log.warn(XLog.OPS, "Previous services singleton active, destroying it");
     SERVICES.destroy();
     SERVICES = null;
   }
   setServiceInternal(XLogService.class, false);
   setServiceInternal(ConfigurationService.class, true);
   conf = get(ConfigurationService.class).getConf();
   systemId = conf.get(CONF_SYSTEM_ID, ("oozie-" + System.getProperty("user.name")));
   if (systemId.length() > MAX_SYSTEM_ID_LEN) {
     systemId = systemId.substring(0, MAX_SYSTEM_ID_LEN);
     XLog.getLog(getClass())
         .warn(
             "System ID [{0}] exceeds maximun lenght [{1}], trimming",
             systemId, MAX_SYSTEM_ID_LEN);
   }
   setSystemMode(SYSTEM_MODE.valueOf(conf.get(CONF_SYSTEM_MODE, SYSTEM_MODE.NORMAL.toString())));
   runtimeDir = createRuntimeDir();
 }
Ejemplo n.º 2
0
 /**
  * Set a service programmatically.
  *
  * <p>The service will be initialized by the services.
  *
  * <p>If a service is already defined with the same public interface it will be destroyed.
  *
  * @param klass service klass
  * @throws ServiceException if the service could not be initialized, at this point all services
  *     have been destroyed.
  */
 public void setService(Class<? extends Service> klass) throws ServiceException {
   setServiceInternal(klass, true);
 }