[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis pull request #2478: ARTEMIS-2210 PagingStore creation is no...

Github user franz1981 commented on a diff in the pull request:

    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java ---
    @@ -335,19 +335,25 @@ public void deletePageStore(final SimpleString storeName) throws Exception {
    -    * stores is a ConcurrentHashMap, so we don't need to synchronize this method
    +    * This method creates a new store if not exist.
        public PagingStore getPageStore(final SimpleString storeName) throws Exception {
           if (managementAddress != null && storeName.startsWith(managementAddress)) {
              return null;
    -      PagingStore store = stores.get(storeName);
    -      if (store != null) {
    -         return store;
    +      try {
    --- End diff --
    I think that `stores.get` is better that will be used in the fast path as it was before: `chm:.get` is completly lock-free, while `chm::computeIfAbsent` will lock on segment level ie better to fallback to `chm::computeIfAbsent` only if `chm::get` return `null`