@Override
 public void run() {
   ExternalSchedulerDiscoveryResult discoveryResult =
       ExternalSchedulerFactory.getInstance().runDiscover();
   if (discoveryResult != null) {
     updateDB(discoveryResult);
     log.info("PolicyUnits updated");
   } else {
     AuditLogableBase loggable = new AuditLogableBase();
     AuditLogDirector.log(loggable, AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY);
     markAllExternalPoliciesAsDisabled();
     log.warn("Discovery returned empty result, disabled external policy units");
   }
 }
 public static void loadDbFacadeConfig() throws Exception {
   boolean configSucceeded = false;
   final String ENGINE_CONF_FILE = "/etc/ovirt-engine/engine.conf";
   final String ON_START_CONNECTION_TIMEOUT = "OnStartConnectionTimeout";
   final String CONNECTION_CHECK_INTERVAL = "ConnectionCheckInterval";
   final String DEFAULT_TIMEOUT_VALUE = "300000";
   final String DEFAULT_INTERVAL_VALUE = "1000";
   InputStream inputStream = null;
   try {
     String onStartConnectionTimeout = null;
     String connectionCheckInterval = null;
     Properties props = new Properties();
     if (FileUtil.fileExists(ENGINE_CONF_FILE)) {
       // File exists, load /etc/ovirt-engine/engine.conf and set values in DbFacade
       inputStream = new FileInputStream(ENGINE_CONF_FILE);
       props.load(inputStream);
       onStartConnectionTimeout = props.getProperty(ON_START_CONNECTION_TIMEOUT);
       connectionCheckInterval = props.getProperty(CONNECTION_CHECK_INTERVAL);
       if (!validNumber(onStartConnectionTimeout)) {
         onStartConnectionTimeout = DEFAULT_TIMEOUT_VALUE;
       }
       if (!validNumber(connectionCheckInterval)) {
         connectionCheckInterval = DEFAULT_INTERVAL_VALUE;
       }
     } else {
       // File does not exist - use defaults
       log.warn(
           String.format(
               "%1$s file is not found. Please check your engine installation. "
                   + "Default values will be used",
               ENGINE_CONF_FILE));
       onStartConnectionTimeout = DEFAULT_TIMEOUT_VALUE;
       connectionCheckInterval = DEFAULT_INTERVAL_VALUE;
     }
     dbFacade.setOnStartConnectionTimeout(Integer.parseInt(onStartConnectionTimeout));
     dbFacade.setConnectionCheckInterval(Integer.parseInt(connectionCheckInterval));
     configSucceeded = true;
   } catch (Exception ex) {
     log.error("Error in configuration of db facade " + ExceptionUtils.getMessage(ex));
   } finally {
     if (!configSucceeded) {
       dbFacade.setOnStartConnectionTimeout(300000);
       dbFacade.setConnectionCheckInterval(1000);
     }
     if (inputStream != null) {
       inputStream.close();
     }
   }
 }