private ResourceResolver getResolver() { if (null == resolver || !resolver.isLive()) { try { resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); } catch (LoginException le) { log.debug(le.getMessage()); } } return resolver; }
public void handleEvent(final Event event) { if (disabled) return; SolrClient solr = getSolrClient(core); PageEvent pageEvent = PageEvent.fromEvent(event); if (pageEvent == null) return; ResourceResolver resourceResolver = null; try { resourceResolver = resolverFactory.getAdministrativeResourceResolver(null); for (Iterator<PageModification> iter = pageEvent.getModifications(); iter.hasNext(); ) handlePageModification(iter.next(), solr, resourceResolver); } catch (Exception e) { LOG.error("Could not get ResourceResolver instance or handle page modification", e); return; } finally { if (resourceResolver != null && resourceResolver.isLive()) resourceResolver.close(); } }