Very minor rulesupport fixes #5074
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While looking for other problems, I studied some of these classes and did some minor adjustments along the way. I actually don't remember what my goal was when I did it, but it was abandoned. I'm left with these minor fixes that I either have to throw away or submit. So, I'm submitting them, since I've made them anyway.
There is no goal here, this is just minor issues that appeared "problematic" and in need of some attention. Since there is no goal, and the changes are so few, I'll describe the details.
ScriptFileReference
compareTo()
,equals()
orhashCode()
is bad. These methods will be called a lot, "behind the scenes", from variousCollection
s or other components. They must perform. The logging also seems more like some debugging that has been left behind. Thus, logging incompareTo()
has been removed.Logger
wasn't in use, and was removed.equals()
didn't have parity withhashCode()
.equals()
only considered one field, whilehashCode()
considered three. I modifiedequals()
to matchhashCode()
.AbstractScriptFileWatcher
scheduler
wasn'tfinal
, but could be (making the field thread-safe, sinceScheduledExecutorService
implementations must be thread-safe).computeIfAbsent()
s that gave null warnings.synchronized
fromgetLockForScript()
because it served no purpose (scriptLockMap
is aConcurrentHashMap
).onReadyMarkerAdded()
: Slight redesign to improve performance and consistency.currentStartLevel
isvolatile
and can change at any time, so one can't assume that the value will remain the same during execution of the method. Also, it has some "penalties" associated with it as avolatile
field (memory barrier, CPU cache flush), so using it like it were a local variable isn't ideal. I changed the method to use a local variable internally, and only accesscurrentStartLevel
the two times that were required: once to read and once to write.