You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/06 21:40:35 UTC
[04/37] incubator-geode git commit: GEODE-613 CI Failure:
LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
GEODE-613 CI Failure: LocatorLoadSnapshotJUnitTest.testConcurrentBalancing
I've removed useless threads and timing loop from the test. It will no longer
time out.
GEODE-1346 Typo "Emtpy" affects Exception name and some help strings
This also removes all unreferenced strings from LocalizedStrings and
removes the no-longer-needed ParentLocalizedStrings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/024cd224
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/024cd224
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/024cd224
Branch: refs/heads/feature/GEODE-1276
Commit: 024cd224ed547e9f59eeaa68f2b5495b05a2665b
Parents: 2da99e7
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu May 5 15:15:58 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Thu May 5 15:39:51 2016 -0700
----------------------------------------------------------------------
.../execute/EmptyRegionFunctionException.java | 63 +++++++++++++++++++
.../execute/EmtpyRegionFunctionException.java | 63 -------------------
.../internal/LocatorLoadSnapshotJUnitTest.java | 65 +++-----------------
3 files changed, 73 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
new file mode 100644
index 0000000..a077779
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmptyRegionFunctionException.java
@@ -0,0 +1,63 @@
+/*
+ * 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.cache.execute;
+
+import com.gemstone.gemfire.distributed.DistributedMember;
+
+/**
+ * Exception to indicate that Region is empty for data aware functions.
+ *
+ * @since 6.5
+ *
+ */
+public class EmptyRegionFunctionException extends FunctionException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * Exception message
+ */
+ public EmptyRegionFunctionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct an instance of EmtpyRegionFunctionException
+ *
+ * @param msg
+ * the error message
+ * @param cause
+ * a Throwable cause of this exception
+ */
+ public EmptyRegionFunctionException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
deleted file mode 100644
index 6aff9eb..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/execute/EmtpyRegionFunctionException.java
+++ /dev/null
@@ -1,63 +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.cache.execute;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-
-/**
- * Exception to indicate that Region is empty for data aware functions.
- *
- * @since 6.5
- *
- */
-public class EmtpyRegionFunctionException extends FunctionException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * Exception message
- */
- public EmtpyRegionFunctionException(String msg) {
- super(msg);
- }
-
- /**
- * Construct an instance of EmtpyRegionFunctionException
- *
- * @param msg
- * the error message
- * @param cause
- * a Throwable cause of this exception
- */
- public EmtpyRegionFunctionException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/024cd224/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
old mode 100644
new mode 100755
index 34ac767..d8a1290
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -257,21 +257,19 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
}
-
+
/**
- * A basic test of concurrent functionality. Starts a number of
+ * A basic test of concurrent functionality. Simulate a number of
* threads making requests and expects the load to be balanced between
* three servers.
* @throws InterruptedException
*/
- @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
@Test
public void testConcurrentBalancing() throws InterruptedException {
int NUM_THREADS = 50;
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; //We should never be off by more than
- //the number of concurrent threads.
-
+
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
final ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -290,47 +288,18 @@ public class LocatorLoadSnapshotJUnitTest {
loadCounts.put(l2, new AtomicInteger(initialLoad2));
loadCounts.put(l3, new AtomicInteger(initialLoad3));
- Thread[] threads = new Thread[NUM_THREADS];
-// final Object lock = new Object();
for(int i =0; i < NUM_THREADS; i++) {
- threads[i] = new Thread("Thread-" + i) {
- public void run() {
- for(int ii = 0; ii < NUM_REQUESTS; ii++) {
- ServerLocation location;
-// synchronized(lock) {
- location = sn.getServerForConnection(null, Collections.EMPTY_SET);
-// }
- AtomicInteger count = (AtomicInteger) loadCounts.get(location);
- count.incrementAndGet();
- }
- }
- };
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- threads[i].start();
- }
-
- for(int i =0; i < NUM_THREADS; i++) {
- Thread t = threads[i];
- long ms = 30 * 1000;
- t.join(30 * 1000);
- if (t.isAlive()) {
- for(int j =0; j < NUM_THREADS; j++) {
- threads[j].interrupt();
- }
- fail("Thread did not terminate after " + ms + " ms: " + t);
+ for(int ii = 0; ii < NUM_REQUESTS; ii++) {
+ ServerLocation location;
+ location = sn.getServerForConnection(null, Collections.EMPTY_SET);
+ AtomicInteger count = (AtomicInteger) loadCounts.get(location);
+ count.incrementAndGet();
}
}
- double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
+ double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 +
NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-// for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
-// Map.Entry entry = (Entry) itr.next();
-// ServerLocation location = (ServerLocation) entry.getKey();
-// AI count= (AI) entry.getValue();
-// }
-
+
for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Entry) itr.next();
ServerLocation location = (ServerLocation) entry.getKey();
@@ -368,18 +337,4 @@ public class LocatorLoadSnapshotJUnitTest {
assertFalse(sn.hasBalancedConnections("b"));
}
- public void _test2() { // delete this method?
- final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
- sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
- }
-
}