try {
cacheStream = cache.createOutputCacheStream();
writer = new PrintWriter(new OutputStreamWriter(cacheStream, "UTF-8"));
DcatJsonFeedWriter feedWriter = new DcatJsonFeedWriter(context, writer, query);
feedWriter.setMessageBroker(msgBroker);
query.setReturnables(new CoreQueryables(context).getFull());
DcatJsonSearchEngine.DcatRecordsAdapter discoveredRecordsAdapter = new DcatJsonSearchEngine.DcatRecordsAdapter(msgBroker, linkBuilder, context, query);
feedWriter.write(discoveredRecordsAdapter);
} finally {
LOGGER.info("DCAT cache update process completed.");
if (writer!=null) {
writer.close();
}