[NO ISSUE][OTH] Eliminate Object Creation on Thread Stats Lookup
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Use the thread object for thread stats lookup
rather than the thread id to avoid boxed objects
creation on stats lookup.
Change-Id: I5b8b26be9d3439889e21cf097ea86c413e973e1d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/3763
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index 3c08462..5afddef 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -80,7 +80,7 @@
private IIOReplicationManager ioReplicationManager;
private final List<ICachedPageInternal> cachedPages = new ArrayList<>();
private final AtomicLong masterPinCount = new AtomicLong();
- private final Map<Long, IThreadStats> statsSubscribers = new ConcurrentHashMap<>();
+ private final Map<Thread, IThreadStats> statsSubscribers = new ConcurrentHashMap<>();
private boolean closed;
@@ -171,7 +171,7 @@
if (DEBUG) {
pinSanityCheck(dpid);
}
- final IThreadStats threadStats = statsSubscribers.get(Thread.currentThread().getId());
+ final IThreadStats threadStats = statsSubscribers.get(Thread.currentThread());
if (threadStats != null) {
threadStats.pagePinned();
}
@@ -585,12 +585,12 @@
@Override
public void subscribe(IThreadStats stats) {
- statsSubscribers.put(Thread.currentThread().getId(), stats);
+ statsSubscribers.put(Thread.currentThread(), stats);
}
@Override
public void unsubscribe() {
- statsSubscribers.remove(Thread.currentThread().getId());
+ statsSubscribers.remove(Thread.currentThread());
}
private int hash(long dpid) {