/** * Returns a log record for a given message Query Id, start and end time. * * @param queryId the message query id * @param startTime the start time * @param endTime the end time * @return the log record or null, if log record is not found in database. * @throws Exception if an error occurs */ public static LogRecord findByQueryId(String queryId, Date startTime, Date endTime) throws Exception { log.trace("findByQueryId({}, {}, {})", new Object[] {queryId, startTime, endTime}); try { assertInitialized(); return (LogRecord) ask(new FindByQueryId(queryId, startTime, endTime)); } catch (Exception e) { throw translateException(e); } }
private static Object ask(Object message) throws Exception { assertInitialized(); Timeout timeout = new Timeout(ASK_TIMEOUT, TimeUnit.SECONDS); Object result = Await.result(Patterns.ask(logManager, message, timeout), timeout.duration()); if (result instanceof Exception) { throw (Exception) result; } else { return result; } }