use of org.n52.sos.ds.cache.InitialCacheUpdate in project SOS by 52North.
the class SosCacheFeederHandler method updateCache.
@Override
public void updateCache(SosWritableContentCache cache) throws OwsExceptionReport {
checkCacheNotNull(cache);
List<OwsExceptionReport> errors = CollectionHelper.synchronizedList();
Session session = null;
try {
InitialCacheUpdate update = new InitialCacheUpdate(this.cacheThreadCount, this.defaultLocale, this.i18NDAORepository, this.sessionStore, this.serviceMetadataRepository, geometryHandler);
session = this.sessionStore.getSession();
update.setCache(cache);
update.setErrors(errors);
update.setSession(session);
LOGGER.info("Starting cache update");
long cacheUpdateStartTime = System.currentTimeMillis();
update.execute();
logCacheLoadTime(cacheUpdateStartTime);
} catch (Exception e) {
LOGGER.error(ERROR_UPDATE_CACHE, e);
errors.add(new NoApplicableCodeException().causedBy(e).withMessage(ERROR_UPDATE_CACHE));
} finally {
try {
this.sessionStore.returnSession(session);
} catch (Exception e2) {
// TODO check why this is necessary
LOGGER.error(ERROR_RETURNING_CONNECTION, e2);
}
}
if (!errors.isEmpty()) {
throw new CompositeOwsException(errors);
}
}
Aggregations