geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [11/13] incubator-geode git commit: GEODE-870: Amending code as per code review Adding wait on CqQueryUsingPoolDUnitTest to make test pass
Date Mon, 29 Feb 2016 05:57:03 GMT
GEODE-870: Amending code as per code review
Adding wait on CqQueryUsingPoolDUnitTest to make test pass


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

Branch: refs/heads/develop
Commit: 21cd26d36919a739c75453c9defacc72516b89fa
Parents: 0eb3777
Author: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Authored: Mon Feb 15 10:05:41 2016 +1100
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Mon Feb 29 16:47:29 2016 +1100

----------------------------------------------------------------------
 .../gms/membership/GMSJoinLeaveHelper.java      | 60 ------------------
 .../gms/membership/GMSJoinLeaveTestHelper.java  | 67 ++++++++++++++++++++
 .../internal/membership/NetView.java            |  3 -
 .../membership/gms/membership/GMSJoinLeave.java |  4 ++
 4 files changed, 71 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/21cd26d3/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveHelper.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveHelper.java
deleted file mode 100644
index b8311bc..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveHelper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed.internal.membership.gms.membership;
-
-import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.DM;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
-import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
-
-public class GMSJoinLeaveHelper {
-  public static boolean isViewCreator() {
-    GMSJoinLeave gmsJoinLeave = getGmsJoinLeave();
-    if (gmsJoinLeave != null) {
-      GMSJoinLeave.ViewCreator viewCreator = gmsJoinLeave.getViewCreator();
-      if (viewCreator != null && !viewCreator.isShutdown()) {
-        return true;
-      } else {
-        return false;
-      }
-    }
-    throw new RuntimeException("This should not have happened. There should be a JoinLeave
for every DS");
-  }
-
-  private static GMSJoinLeave getGmsJoinLeave() {
-    InternalDistributedSystem distributedSystem = getInternalDistributedSystem();
-    DM dm = distributedSystem.getDM();
-    GMSMembershipManager membershipManager = (GMSMembershipManager) dm.getMembershipManager();
-    Services services = membershipManager.getServices();
-    return (GMSJoinLeave) services.getJoinLeave();
-  }
-
-  public static Integer getViewId() {
-    return getGmsJoinLeave().getView().getViewId();
-  }
-
-  private static InternalDistributedSystem getInternalDistributedSystem() {
-    InternalDistributedSystem distributedSystem = InternalDistributedSystem.getAnyInstance();
-    if (distributedSystem == null) {
-      Locator locator = Locator.getLocator();
-      return (InternalDistributedSystem) locator.getDistributedSystem();
-    } else {
-      return distributedSystem;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/21cd26d3/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
new file mode 100644
index 0000000..493c625
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed.internal.membership.gms.membership;
+
+import com.gemstone.gemfire.distributed.Locator;
+import com.gemstone.gemfire.distributed.internal.DM;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
+import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
+
+public class GMSJoinLeaveTestHelper {
+
+  public static void becomeCoordinatorForTest(GMSJoinLeave gmsJoinLeave) {
+    synchronized (gmsJoinLeave.getViewInstallationLock()) {
+      gmsJoinLeave.becomeCoordinator();
+    }
+  }
+
+  public static boolean isViewCreator() {
+    GMSJoinLeave gmsJoinLeave = getGmsJoinLeave();
+    if (gmsJoinLeave != null) {
+      GMSJoinLeave.ViewCreator viewCreator = gmsJoinLeave.getViewCreator();
+      if (viewCreator != null && !viewCreator.isShutdown()) {
+        return true;
+      } else {
+        return false;
+      }
+    }
+    throw new RuntimeException("This should not have happened. There should be a JoinLeave
for every DS");
+  }
+
+  private static GMSJoinLeave getGmsJoinLeave() {
+    InternalDistributedSystem distributedSystem = getInternalDistributedSystem();
+    DM dm = distributedSystem.getDM();
+    GMSMembershipManager membershipManager = (GMSMembershipManager) dm.getMembershipManager();
+    Services services = membershipManager.getServices();
+    return (GMSJoinLeave) services.getJoinLeave();
+  }
+
+  public static Integer getViewId() {
+    return getGmsJoinLeave().getView().getViewId();
+  }
+
+  private static InternalDistributedSystem getInternalDistributedSystem() {
+    InternalDistributedSystem distributedSystem = InternalDistributedSystem.getAnyInstance();
+    if (distributedSystem == null) {
+      Locator locator = Locator.getLocator();
+      return (InternalDistributedSystem) locator.getDistributedSystem();
+    } else {
+      return distributedSystem;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/21cd26d3/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
index af05f82..af4aec3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
@@ -48,9 +48,6 @@ import com.gemstone.gemfire.internal.Version;
  */
 public class NetView implements DataSerializableFixedID {
 
-  private static final Logger logger = LogService.getLogger();
-
-
   private int viewId;
   private List<InternalDistributedMember> members;
   private int[] failureDetectionPorts = new int[10];

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/21cd26d3/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index dca2b7d..3d8b2e5 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -237,6 +237,10 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
     }
   }
 
+  Object getViewInstallationLock() {
+    return viewInstallationLock;
+  }
+
   /**
    * attempt to join the distributed system
    * loop


Mime
View raw message