This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit cd38729428bb24d394352559e351ef3bd6dffdc3
Author: Murtadha Hubail <[email protected]>
AuthorDate: Tue Oct 15 16:55:55 2019 +0300

    [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 <[email protected]>
    Integration-Tests: Jenkins <[email protected]>
    Reviewed-by: Murtadha Hubail <[email protected]>
    Reviewed-by: Michael Blow <[email protected]>
---
 .../apache/hyracks/storage/common/buffercache/BufferCache.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 @@ public class BufferCache implements IBufferCacheInternal, 
ILifeCycleComponent, I
     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 @@ public class BufferCache implements IBufferCacheInternal, 
ILifeCycleComponent, I
         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 @@ public class BufferCache implements IBufferCacheInternal, 
ILifeCycleComponent, I
 
     @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) {

Reply via email to