colinwerner commented on code in PR #2664:
URL: https://github.com/apache/activemq/pull/2664#discussion_r4276615366
##########
activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java:
##########
@@ -243,8 +250,29 @@ public void setHandleStartException(boolean
handleStartException) {
this.handleStartException = handleStartException;
}
+ public long getLockAcquireRetryInterval() {
+ return lockAcquireRetryInterval;
+ }
+
+ /**
+ * Sets the time, in milliseconds, to wait between attempts to acquire the
lease.
+ * lockAcquireSleepInterval remains the lease duration, so a shorter retry
interval lets
+ * a waiting broker pick up an expired or released lease sooner without
shortening the lease.
+ * A value less than or equal to zero (the default) uses
lockAcquireSleepInterval.
+ *
+ * @param lockAcquireRetryInterval the wait between lease acquire attempts
in milliseconds
+ */
+ public void setLockAcquireRetryInterval(long lockAcquireRetryInterval) {
+ this.lockAcquireRetryInterval = lockAcquireRetryInterval;
+ }
+
+ protected long getEffectiveLockAcquireRetryInterval() {
+ return lockAcquireRetryInterval > 0 ? lockAcquireRetryInterval :
lockAcquireSleepInterval;
+ }
+
@Override
public String toString() {
- return "LeaseDatabaseLocker owner:" + leaseHolderId + ",duration:" +
lockAcquireSleepInterval + ",renew:" + lockAcquireSleepInterval;
+ return "LeaseDatabaseLocker owner:" + leaseHolderId + ",duration:" +
lockAcquireSleepInterval + ",renew:" + (lockable != null ?
lockable.getLockKeepAlivePeriod() : -1)
Review Comment:
This toString() change isn't required for lockAcquireRetryInterval. It's
included because renew previously printed lockAcquireSleepInterval (the same
value as duration), while the lease is actually renewed every
lockKeepAlivePeriod of the lockable service. Since this PR separates the
locker's timings, it seemed worth making the one place that reports them
accurate: duration, renew and retry are the three values that determine
failover time. lockable is null until the locker is configured, so renew prints
-1 in that case. It's a separate commit, so I'm happy to drop it or move it to
its own PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact