-
Notifications
You must be signed in to change notification settings - Fork 471
Improve timekeeping code #6041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve timekeeping code #6041
Conversation
dlmarion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a couple of comments about using Duration.dividedBy and Duration.multipliedBy to avoid extra object creation instead of doing those operations on primitives.
core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
Outdated
Show resolved
Hide resolved
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
Outdated
Show resolved
Hide resolved
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java
Outdated
Show resolved
Hide resolved
| long currentNanos = System.nanoTime(); | ||
| if ((currentNanos - lastRun) >= threshold) { | ||
| Duration threshold = Duration.ofMillis(maxAgeMillis.getAsLong() / 2); | ||
| if (threshold.compareTo(minInterval) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guava has Comparators.min and Comparators.max that could be used like the existing code uses Math.min and Math.max. These changes are fine though, just pointing those out in case you were not aware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out, I did not know of those. As I was writing this code I was wondering why there wasn't an equivalent for Duration variables but never looked into it.
Added in 17dd12d
Adds changes to several files that:
Durationvslong