kirklund commented on a change in pull request #6179:
URL: https://github.com/apache/geode/pull/6179#discussion_r601757240
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/offheap/ReferenceCountHelperImpl.java
##########
@@ -278,28 +290,47 @@ void freeRefCountInfo(Long address) {
* Returns the thread local owner
*/
Object getReferenceCountOwner() {
- if (!trackReferenceCounts())
+ if (!trackReferenceCounts()) {
return null;
+ }
return refCountOwner.get();
}
/**
* Returns the thread local count of the number of times ref count has been
updated
*/
AtomicInteger getReenterCount() {
- if (!trackReferenceCounts())
+ if (!trackReferenceCounts()) {
return null;
+ }
return refCountReenterCount.get();
}
/**
* Returns a list of any free operation tracking information. This is used
to describe who did the
* previous free(s) when an extra one ends up being done and fails.
*/
- public List<RefCountChangeInfo> getFreeRefCountInfo(long address) {
- if (!trackReferenceCounts() || !trackFreedReferenceCounts())
+ List<RefCountChangeInfo> getFreeRefCountInfo(long address) {
+ if (!trackReferenceCounts() || !trackFreedReferenceCounts()) {
return null;
+ }
return freedStacktraces.get(address);
}
+ /**
+ * This method is overridden during testing to allow simulation of a
concurrent update occurring
+ * between stacktraces.get and stacktraces.replace
+ */
+ void getReferenceCountInfoTestHook(ConcurrentMap<Long,
List<RefCountChangeInfo>> stacktraces,
+ long address) {
+ // nothing
+ }
+
+ /**
+ * This method is overridden during testing to allow simulation of a race to
be the first to
+ * reference a given address
+ */
+ void refCountChangedTestHook(Long address, boolean decRefCount, int rc) {
Review comment:
I don't want to change this class further without someone spending time
analyzing the change in performance for using Long vs long parameters. There is
a small performance change if I change the to/from a wrapper instead of
primitive.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]