public static CRLFetcherFactory getInstance() { if (instance == null) { synchronized (CRLFetcherFactory.class) { if (instance == null) { instance = new CRLFetcherFactory(); } } } return instance; }
/** * Get a CRL fetcher based on the configuration * @param conf Hadoop configuration * @return CRLFetcher instance * @throws ClassNotFoundException * @throws URISyntaxException */ public synchronized CRLFetcher getCRLFetcher(Configuration conf) throws ClassNotFoundException, URISyntaxException { String crlFetcherClass = conf.get(CommonConfigurationKeys.HOPS_CRL_FETCHER_CLASS_KEY, CommonConfigurationKeys .HOPS_CRL_FETCHER_CLASS_DEFAULT); if (fetcher != null) { return fetcher; } Class<?> clazz = conf.getClassByName(crlFetcherClass); fetcher = (CRLFetcher) ReflectionUtils.newInstance(clazz, conf); setInputURI(conf, fetcher); setOutputURI(conf, fetcher); return fetcher; }
@Override public void serviceInit(Configuration conf) throws Exception { LOG.info("Initializing CRL fetching service"); crlFetcher = CRLFetcherFactory.getInstance().getCRLFetcher(conf); fetcherInterval = conf.getTimeDuration(CommonConfigurationKeys.HOPS_CRL_FETCHER_INTERVAL_KEY, CommonConfigurationKeys.HOPS_CRL_FETCHER_INTERVAL_DEFAULT, intervalTimeUnit); // Minimum fetcher interval for normal execution is 2 hours if (intervalTimeUnit.equals(TimeUnit.MINUTES) && fetcherInterval < 120) { LOG.info("Configured fetcher interval is too low " + fetcherInterval + " falling back to 120 minutes"); fetcherInterval = 120; } super.serviceInit(conf); }