@SuppressFBWarnings( value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT", justification = "Return value of context.stop() is not required.") public void persist(Connection connection, Collection<Message> messageList) throws SQLException { PreparedStatement metadataStmt = null; PreparedStatement contentStmt = null; PreparedStatement insertToQueueStmt = null; Context context = metricManager.startMessageWriteTimer(); try { metadataStmt = connection.prepareStatement(RDBMSConstants.PS_INSERT_METADATA); contentStmt = connection.prepareStatement(RDBMSConstants.PS_INSERT_CONTENT); insertToQueueStmt = connection.prepareStatement(RDBMSConstants.PS_INSERT_INTO_QUEUE); for (Message message : messageList) { prepareMetadata(metadataStmt, message); prepareContent(contentStmt, message); prepareQueueAttachments(insertToQueueStmt, message); } metadataStmt.executeBatch(); contentStmt.executeBatch(); insertToQueueStmt.executeBatch(); } catch (SQLException e) { throw new SQLException("Error persisting messages.", e); } finally { context.stop(); close(metadataStmt); close(contentStmt); close(insertToQueueStmt); } }
@SuppressFBWarnings( value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT", justification = "Return value of context.stop() is not required.") public void delete(Connection connection, Collection<Long> internalIdList) throws BrokerException { PreparedStatement statement = null; Context context = metricManager.startMessageDeleteTimer(); try { statement = connection.prepareStatement(RDBMSConstants.PS_DELETE_MESSAGE); for (Long internalId : internalIdList) { statement.setLong(1, internalId); statement.addBatch(); } statement.executeBatch(); } catch (SQLException e) { throw new BrokerException("Error occurred while deleting messages", e); } finally { context.stop(); close(statement); } }
@Override public void stopTimer() { timerContext.stop(); }
@Override public void stopTimer() { timerContext.stop(); } }
@Override public void stopTimer() { timerContext.stop(); } }
@Override public void postCall(Request request, int status, ServiceMethodInfo serviceMethodInfo) { Timer.Context context = (Timer.Context) serviceMethodInfo.getAttribute(TIMER_CONTEXT); context.stop(); } }
@Override public void stopTimer() { timerContext.stop(); } }
@Override public void stopTimer() { if (this.connectionTimerContext != null) { this.connectionTimerContext.stop(); } }
@Override public void stopTimer() { timerContext.stop(); } }
@Override public int[] getRandomNumbers() { Timer.Context context = timer.start(); try { int[] numbers = random.ints(random.nextInt(1000001), randomNumberOrigin, randomNumberBound).toArray(); histogram.update(numbers.length); return numbers; } finally { context.stop(); } }