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.
This commit is contained in:
aslepykh 2024-02-29 10:00:54 +03:00 committed by Justin Bertram
parent fc13a39c6f
commit bc86a0a481
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem
final long measuredRenewPeriodNanos = renewStart - lastRenewStart; final long measuredRenewPeriodNanos = renewStart - lastRenewStart;
final long measuredRenewPeriodMillis = TimeUnit.NANOSECONDS.toMillis(measuredRenewPeriodNanos); final long measuredRenewPeriodMillis = TimeUnit.NANOSECONDS.toMillis(measuredRenewPeriodNanos);
if (measuredRenewPeriodMillis - expirationMillis > 100) { 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) { } else if (measuredRenewPeriodMillis - expectedRenewPeriodMillis > 100) {
logger.warn("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis); logger.warn("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis);
} }