Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ public void run() {
long start = System.currentTimeMillis();
while (!this.isStopped()) {
try {
if (System.currentTimeMillis() - start > brokerController.getBrokerConfig().getTransactionMetricFlushInterval()) {
// Bug fix: original code only called waitForRunning inside the if-branch,
// so on every iteration where the interval hadn't elapsed yet the loop
// spun without yielding (~170 CPU samples in JFR on idle broker).
// Now we always wait, then check whether enough time has passed to persist.
long interval = brokerController.getBrokerConfig().getTransactionMetricFlushInterval();
this.waitForRunning(interval);
if (System.currentTimeMillis() - start > interval) {
Comment on lines +48 to +50
start = System.currentTimeMillis();
brokerController.getTransactionalMessageService().getTransactionMetrics().persist();
waitForRunning(brokerController.getBrokerConfig().getTransactionMetricFlushInterval());
}
} catch (Throwable e) {
log.error("Error occurred in " + getServiceName(), e);
Expand Down
Loading