You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/11/07 09:11:21 UTC

[GitHub] [iotdb] asdf2014 commented on a change in pull request #1968: Fix the risk of deadlock by WeakReference

asdf2014 commented on a change in pull request #1968:
URL: https://github.com/apache/iotdb/pull/1968#discussion_r519156136



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
##########
@@ -60,6 +64,7 @@
 
   private final ReadWriteLock lock = new ReentrantReadWriteLock();
 
+  private final Map<String, WeakReference<String>> devices = Collections.synchronizedMap(new WeakHashMap<>());

Review comment:
       Hi, @jixuan1989 . Thanks for your reply. Indeed, taking this into consideration, so WeakReference is used here, which is more GC friendly. Moreover, I think the previous method has the risk of deadlock and the memory usage is not small.




----------------------------------------------------------------
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:
users@infra.apache.org