jacek-lewandowski commented on code in PR #2046:
URL: https://github.com/apache/cassandra/pull/2046#discussion_r1158423241
##########
src/java/org/apache/cassandra/gms/FailureDetector.java:
##########
@@ -55,21 +58,19 @@ public class FailureDetector implements IFailureDetector,
FailureDetectorMBean
private static final int SAMPLE_SIZE = 1000;
protected static final long INITIAL_VALUE_NANOS =
TimeUnit.NANOSECONDS.convert(getInitialValue(), TimeUnit.MILLISECONDS);
private static final int DEBUG_PERCENTAGE = 80; // if the phi is larger
than this percentage of the max, log a debug message
- private static final long DEFAULT_MAX_PAUSE = 5000L * 1000000L; // 5
seconds
private static final long MAX_LOCAL_PAUSE_IN_NANOS = getMaxLocalPause();
private long lastInterpret = preciseTime.now();
private long lastPause = 0L;
private static long getMaxLocalPause()
{
- if (System.getProperty("cassandra.max_local_pause_in_ms") != null)
- {
- long pause =
Long.parseLong(System.getProperty("cassandra.max_local_pause_in_ms"));
- logger.warn("Overriding max local pause time to {}ms", pause);
- return pause * 1000000L;
- }
- else
- return DEFAULT_MAX_PAUSE;
+ long pause = MAX_LOCAL_PAUSE_IN_MS.getLong();
+
+ if
(!String.valueOf(pause).equals(MAX_LOCAL_PAUSE_IN_MS.getDefaultValue()))
Review Comment:
I think it does not matter where the default is defined. Perhaps a way to
shorten such snippet is to provide an overloaded method, say `getString(String
default, boolean log)` which would just log if the retrieved value is different
than the provided default? Whether to log or not, could be alternatively
defined on the property declaration level, as optional parameter, say
`MAX_LOCAL_PAUSE_IN_MS("cassandra.max_local_pause_in_ms", "5000", true)` (it
does not matter whether the default is provided in CRP or ad-hoc). wdyt?
--
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]