geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [geode] branch develop updated: GEODE-6349: Fix potential race in DistributedRegionBridge.listAllRegions (#3147)
Date Fri, 01 Feb 2019 23:44:23 GMT
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 98c0710  GEODE-6349: Fix potential race in DistributedRegionBridge.listAllRegions
(#3147)
98c0710 is described below

commit 98c0710b84e997bf49ded1077826413259d6aff2
Author: Jens Deppe <jdeppe@pivotal.io>
AuthorDate: Fri Feb 1 15:44:07 2019 -0800

    GEODE-6349: Fix potential race in DistributedRegionBridge.listAllRegions (#3147)
---
 .../management/internal/beans/DistributedSystemBridge.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
index b160f09..95244d9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
@@ -820,18 +820,18 @@ public class DistributedSystemBridge {
    * @return a list of region names hosted on the system
    */
   public String[] listAllRegions() {
-    Iterator<DistributedRegionBridge> it = distrRegionMap.values().iterator();
     if (distrRegionMap.values().size() == 0) {
       return ManagementConstants.NO_DATA_STRING;
     }
-    String[] listOfRegions = new String[distrRegionMap.values().size()];
-    int j = 0;
+
+    List<String> listOfRegions = new ArrayList<>();
+    Iterator<DistributedRegionBridge> it = distrRegionMap.values().iterator();
     while (it.hasNext()) {
       DistributedRegionBridge bridge = it.next();
-      listOfRegions[j] = bridge.getName();
-      j++;
+      listOfRegions.add(bridge.getName());
     }
-    return listOfRegions;
+
+    return listOfRegions.toArray(new String[listOfRegions.size()]);
   }
 
   /**


Mime
View raw message