GEODE-416: Fixed synchronization issue when receiving notifications

Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b3133629
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b3133629
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b3133629

Branch: refs/heads/feature/GEODE-11
Commit: b313362961809758a27c3c402adc64543610e5ee
Parents: e96c960
Author: Jens Deppe <[email protected]>
Authored: Tue Nov 10 06:43:09 2015 -0800
Committer: Jens Deppe <[email protected]>
Committed: Tue Nov 10 06:43:09 2015 -0800

----------------------------------------------------------------------
 .../gemfire/management/DistributedSystemDUnitTest.java  | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b3133629/gemfire-core/src/test/java/com/gemstone/gemfire/management/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/management/DistributedSystemDUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/DistributedSystemDUnitTest.java
index 3cf3a6e..193dd12 100644
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/management/DistributedSystemDUnitTest.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/DistributedSystemDUnitTest.java
@@ -17,6 +17,7 @@
 package com.gemstone.gemfire.management;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -94,7 +95,7 @@ public class DistributedSystemDUnitTest extends 
ManagementTestBase {
   
   private static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
   
-  static List<Notification> notifList = new ArrayList<Notification>();
+  static List<Notification> notifList = new ArrayList<>();
   
   static Map<ObjectName , NotificationListener> notificationListenerMap = new 
HashMap<ObjectName , NotificationListener>();
   
@@ -154,8 +155,8 @@ public class DistributedSystemDUnitTest extends 
ManagementTestBase {
       createCache(vm);
       warnLevelAlert(vm);
       severeLevelAlert(vm);
-      
     }
+
     VM managingNode = getManagingNode();
     createManagementCache(managingNode);
     startManagingNode(managingNode);
@@ -266,9 +267,8 @@ public class DistributedSystemDUnitTest extends 
ManagementTestBase {
 
     class NotificationHubTestListener implements NotificationListener {
       @Override
-      public void handleNotification(Notification notification, Object 
handback) {
+      public synchronized void handleNotification(Notification notification, 
Object handback) {
         notifList.add(notification);
-
       }
     }
 
@@ -291,9 +291,7 @@ public class DistributedSystemDUnitTest extends 
ManagementTestBase {
                 } else {
                   return false;
                 }
-
               }
-
             }, MAX_WAIT, 500, true);
             for (ObjectName objectName : bean.listMemberObjectNames()) {
               NotificationHubTestListener listener = new 
NotificationHubTestListener();
@@ -369,9 +367,7 @@ public class DistributedSystemDUnitTest extends 
ManagementTestBase {
             } else {
               return false;
             }
-
           }
-
         }, MAX_WAIT, 500, true);
 
         notifList.clear();

Reply via email to