From bc86a0a481879542525cb18243d23f51e3ae833d Mon Sep 17 00:00:00 2001 From: aslepykh <145323274+aslepykh@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:00:54 +0300 Subject: [PATCH] ARTEMIS-4695 BAD_COPY_PASTE in ActiveMQScheduledLeaseLock.java In the detectAndReportRenewSlowness() method, the logger.error() and logger.warn() methods are called 3 times. In two of the three calls, the method arguments correspond to parameters that are tested in the if() conditional construct. Also, the arguments of the logger.error() and logger.warn() methods are identical in lines 139 and 141, respectively, which may indicate that they were copied incorrectly. --- .../core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java index a4d8b81262..523df09943 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java @@ -136,7 +136,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem final long measuredRenewPeriodNanos = renewStart - lastRenewStart; final long measuredRenewPeriodMillis = TimeUnit.NANOSECONDS.toMillis(measuredRenewPeriodNanos); if (measuredRenewPeriodMillis - expirationMillis > 100) { - logger.error("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis); + logger.error("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expirationMillis); } else if (measuredRenewPeriodMillis - expectedRenewPeriodMillis > 100) { logger.warn("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis); }