incubator-geode git commit: GEODE-77 kicked-out members were not recognizing they were shunned

2015-08-19 Thread bschuchardt
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-77 c5c8565c6 - c61fe3466


GEODE-77 kicked-out members were not recognizing they were shunned

Members kicked out of the system were not properly processing messages
from the coordinator telling them to shut down.
This also renames the new commands in the deadlock detector.


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

Branch: refs/heads/feature/GEODE-77
Commit: c61fe3466f0507f76a487f03b662447a0e0b3011
Parents: c5c8565
Author: Bruce Schuchardt bschucha...@pivotal.io
Authored: Wed Aug 19 13:22:34 2015 -0700
Committer: Bruce Schuchardt bschucha...@pivotal.io
Committed: Wed Aug 19 13:22:34 2015 -0700

--
 .../internal/deadlock/DeadlockDetector.java | 22 ++--
 .../internal/deadlock/DependencyGraph.java  | 13 +---
 .../deadlock/MessageDependencyMonitor.java  |  4 +++-
 .../membership/gms/membership/GMSJoinLeave.java | 15 +++--
 .../gms/messages/LeaveRequestMessage.java   |  9 +++-
 .../cli/commands/MiscellaneousCommands.java |  2 +-
 6 files changed, 46 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c61fe346/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetector.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetector.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetector.java
index 724b328..7999aea 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetector.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetector.java
@@ -318,12 +318,12 @@ public class DeadlockDetector {
 System.out.println(system created by collectDependencies.);
 System.out.println();
 System.out.println(usage: );
-System.out.println([print | findDeepestGraph | findDeadlockOnly | 
findThread threadName ] file1 ...);
+System.out.println([print | findImpasse | findCycle | findObject 
objectName ] file1 ...);
 System.out.println();
 System.out.println(print - prints all dependencies and threads in the 
graph);
-System.out.println(findDeepestGraph - looks for either a deadlock or the 
longest call chain in the graph);
-System.out.println(findDeadlockOnly - looks for a deadlock in the 
distributed system);
-System.out.println(findThread - finds the given thread by name/partial 
name and builds a dependency graph around it);
+System.out.println(findImpasse - looks for either a deadlock or the 
longest call chain in the graph);
+System.out.println(findCycle - looks for a deadlock);
+System.out.println(findObject - finds the given object (thread, lock, 
message) by name/partial name and finds all call chains leading to that 
object);
   }
 
   public static void main(String... args) throws Exception {
@@ -339,7 +339,7 @@ public class DeadlockDetector {
   graph = loadGraphs(1, args);
   System.out.println(prettyFormat(graph));
   break;
-case findDeadlockOnly:
+case findCycle:
   graph = loadGraphs(1, args);
   ListDependency cycle = graph.findCycle();
   if (cycle == null) {
@@ -348,16 +348,16 @@ public class DeadlockDetector {
 System.out.println(deadlocked threads: \n + cycle);
   }
   break;
-case findDeepestGraph:
+case findImpasse:
   graph = loadGraphs(1, args);
-  graph = graph.findDeepestGraph();
+  graph = graph.findLongestCallChain();
   if (graph == null) {
-System.out.println(no deepest graph could be found!);
+System.out.println(no long call chain could be found!);
   } else {
-System.out.println(deepest graph: \n + prettyFormat(graph));
+System.out.println(longest call chain: \n + prettyFormat(graph));
   }
   break;
-case findThread:
+case findObject:
   graph = loadGraphs(2, args);
   ListDependencyGraph graphs = graph.findDependenciesWith(args[1]);
   if (graphs.isEmpty()) {
@@ -365,7 +365,7 @@ public class DeadlockDetector {
   } else {
 int numGraphs = graphs.size();
 int i=0;
-System.out.println(findThread \ + args[1]+\n\n);
+System.out.println(findObject \ + args[1]+\\n\n);
 for (DependencyGraph g: graphs) {
   i += 1;
   System.out.println(graph  + i +  of  + numGraphs + :);


[11/12] incubator-geode git commit: GEODE-213: New unit test that confirms bug

2015-08-19 Thread klund
GEODE-213: New unit test that confirms bug


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

Branch: refs/heads/develop
Commit: 581702ac1d2a9debe8619680d09fa868b9ca8b05
Parents: f246c7f
Author: Kirk Lund kl...@pivotal.io
Authored: Wed Aug 19 16:01:26 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:07 2015 -0700

--
 build.gradle|   2 +
 .../WanCommandsControllerJUnitTest.java | 162 +++
 2 files changed, 164 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/581702ac/build.gradle
--
diff --git a/build.gradle b/build.gradle
index 42b4a14..d7b4965 100755
--- a/build.gradle
+++ b/build.gradle
@@ -278,11 +278,13 @@ subprojects {
 testCompile 'com.github.stefanbirkner:system-rules:1.9.0'
 testCompile 'edu.umd.cs.mtc:multithreadedtc:1.01'
 testCompile 'junit:junit:4.12'
+testCompile 'org.assertj:assertj-core:2.1.0'
 testCompile 'org.mockito:mockito-core:1.10.19'
 testCompile 'org.hamcrest:hamcrest-all:1.3'
 testCompile 'org.jmock:jmock:2.8.1'
 testCompile 'org.jmock:jmock-junit4:2.8.1'
 testCompile 'org.jmock:jmock-legacy:2.8.1'
+testCompile 'pl.pragmatists:JUnitParams:1.0.4'
 
 testRuntime 'cglib:cglib:3.1'
 testRuntime 'org.objenesis:objenesis:2.1'

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/581702ac/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
new file mode 100755
index 000..fb39d8c
--- /dev/null
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
@@ -0,0 +1,162 @@
+package com.gemstone.gemfire.management.internal.web.controllers;
+
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
+import static junitparams.JUnitParamsRunner.$;
+import static org.assertj.core.api.Assertions.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+/**
+ * Unit tests for WanCommandsController. 
+ * 
+ * Introduced for GEODE-213 JMX -http manager treats start gateway-sender 
as start gateway-receiver
+ *  
+ * @author Kirk Lund
+ */
+@SuppressWarnings(unused)
+@Category(UnitTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class WanCommandsControllerJUnitTest {
+
+  private TestableWanCommandsController wanCommandsController;
+  
+  @Before
+  public void setUp() {
+this.wanCommandsController = new TestableWanCommandsController();
+  }
+  
+  private static final Object[] getParametersWithGroups() {
+return $(
+new Object[] { sender1, new String[] { group1 }, new String[] { }, 
true, false },
+new Object[] { sender2, new String[] { group1, group2 }, new 
String[] { }, true, false }
+);
+  }
+
+  private static final Object[] getParametersWithMembers() {
+return $(
+new Object[] { sender3, new String[] { }, new String[] { member1 
}, false, true },
+new Object[] { sender4, new String[] { }, new String[] { member1, 
member2 }, false, true }
+);
+  }
+  
+  private static final Object[] getParametersWithGroupsAndMembers() {
+return $(
+new Object[] { sender5, new String[] { group1 }, new String[] { 
member1 }, true, true },
+new Object[] { sender6, new String[] { group1,group2 }, new 
String[] { member1,member2 }, true, true },
+new Object[] { sender7, new String[] { group1, group2 }, new 
String[] { member1, member2 }, true, true }
+);
+  }
+  
+  @Test
+  public void shouldDefineStartGatewayReceiverCommandWithNulls() {
+this.wanCommandsController.startGatewaySender(null, null, null);
+
+
assertThat(this.wanCommandsController.testableCommand).contains(--+START_GATEWAYSENDER__ID+=+null);
+
assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYSENDER);
+
assertThat(this.wanCommandsController.testableCommand).doesNotContain(START_GATEWAYRECEIVER__GROUP);

[07/12] incubator-geode git commit: GEODE-214: improve Azul support

2015-08-19 Thread klund
GEODE-214: improve Azul support

- isTenured now looks for GenPauseless Old Gen for azul.
- Azul jvm version no longer logged as unsupported.
- Fatal log message about jvm version not being supported
  is now a warning since we continue to run.
- Fixed a bug in ReflectionSingleObjectSizer in how it calculated
  the size of a field. It was calling Field.getClass instead of Field.getType.
  Field.getClass always returns an instance of Field.class which the sizer
  always says is an objref size. getType will return a primitive class
  for primitive fields which is what we want.
- Improved ObjectSizerJUnitTest.
- The object header size and reference size are now correctly computed
  for azul.
- Added some java 8 support to the ObjectSizer.
- Fix tests that are unintentionally spawning processes that use the
  default mcast-port. This fixes intermittent failures caused by finding
  another member of the wrong GemFire version.


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

Branch: refs/heads/develop
Commit: 57c5247df2401a2149104e0d7f65c4aea0993008
Parents: abb11d3
Author: Darrel Schneider dschnei...@pivotal.io
Authored: Tue Jun 2 10:45:30 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:04 2015 -0700

--
 .../gemfire/internal/SharedLibrary.java | 20 ++-
 .../cache/MinimumSystemRequirements.java|  4 +-
 .../cache/control/HeapMemoryMonitor.java|  1 +
 .../gemfire/internal/lang/SystemUtils.java  | 35 ++--
 .../size/ReflectionSingleObjectSizer.java   |  4 +-
 .../LocatorLauncherRemoteFileJUnitTest.java |  8 +--
 .../LocatorLauncherRemoteJUnitTest.java | 57 
 .../ServerLauncherLocalJUnitTest.java   | 47 ++--
 .../ServerLauncherRemoteFileJUnitTest.java  |  2 -
 .../ServerLauncherWithSpringJUnitTest.java  |  2 +
 .../internal/size/ObjectSizerJUnitTest.java | 14 -
 11 files changed, 126 insertions(+), 68 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c5247d/gemfire-core/src/main/java/com/gemstone/gemfire/internal/SharedLibrary.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/SharedLibrary.java 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/SharedLibrary.java
index 59ab34e..fd923ad 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/SharedLibrary.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/SharedLibrary.java
@@ -8,6 +8,7 @@
 package com.gemstone.gemfire.internal;
 
 import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.internal.lang.SystemUtils;
 import com.gemstone.gemfire.pdx.internal.unsafe.UnsafeWrapper;
 
 import java.io.File;
@@ -68,9 +69,19 @@ public class SharedLibrary {
   int scaleIndex = 0;
   int tmpReferenceSize = 0;
   int tmpObjectHeaderSize = 0;
+  if (SystemUtils.isAzulJVM()) {
+tmpObjectHeaderSize = 8;
+tmpReferenceSize = 8;
+  } else {
   if (unsafe != null) {
 // Use unsafe to figure out the size of an object reference since we 
might
 // be using compressed oops.
+// Note: as of java 8 compressed oops do not imply a compressed object 
header.
+// The object header is determined by UseCompressedClassPointers.
+// UseCompressedClassPointers requires UseCompressedOops
+// but UseCompressedOops does not require UseCompressedClassPointers.
+// But it seems unlikely that someone would compress their oops
+// not their class pointers. 
 scaleIndex = unsafe.arrayScaleIndex(Object[].class);
 if (scaleIndex == 4) {
   // compressed oops
@@ -85,8 +96,12 @@ public class SharedLibrary {
 }
   }
   if (scaleIndex == 0) {
-// If our heap is  32G then assume large oops. Otherwise assume 
compressed oops.
-if (Runtime.getRuntime().maxMemory()  (32L*1024*1024*1024)) {
+// If our heap is  32G (64G on java 8) then assume large oops. 
Otherwise assume compressed oops.
+long SMALL_OOP_BOUNDARY = 32L;
+if (SystemUtils.isJavaVersionAtLeast(1.8)) {
+  SMALL_OOP_BOUNDARY = 64L;
+}
+if (Runtime.getRuntime().maxMemory()  
(SMALL_OOP_BOUNDARY*1024*1024*1024)) {
   tmpReferenceSize = 8;
   tmpObjectHeaderSize = 16;
 } else {
@@ -94,6 +109,7 @@ public class SharedLibrary {
   tmpObjectHeaderSize = 12;
 }
   }
+  }
   referenceSize = 

[03/12] incubator-geode git commit: GEODE-195: Remove debug logging from CloseCacheAuthorization

2015-08-19 Thread klund
GEODE-195: Remove debug logging from CloseCacheAuthorization


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

Branch: refs/heads/develop
Commit: 68b2124062edb72e36efa4cf202be56ac965cd4c
Parents: 65e9694
Author: Jason Huynh jhu...@pivotal.io
Authored: Thu Aug 13 11:10:08 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:01 2015 -0700

--
 .../gemfire/cache/query/dunit/CloseCacheAuthorization.java | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/68b21240/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
index d269ddc..b259c60 100644
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
@@ -36,8 +36,6 @@ public class CloseCacheAuthorization extends TestCase 
implements AccessControl {
 
   @Override
   public boolean authorizeOperation(String regionName, OperationContext 
context) {
-this.logger.info( JASON Authorizing request  + 
context.getOperationCode() +  class: + context.getClass().getName());
-new Exception(JASON authz stack).printStackTrace();
 if (context instanceof ExecuteCQOperationContext) {
   cache.close();
   //return false;



[06/12] incubator-geode git commit: GEODE-216: Handle any exception that might be thrown

2015-08-19 Thread klund
GEODE-216: Handle any exception that might be thrown

The old code was trying to prevent a deadlock under some certain
conditions. But if it can not get a PR because of an exception
then a deadlock is not possible. So the new code just catches
and ignores exceptions and falls through to the code that will
process the message the old way. This code will encounter the
same exception and has the proper logic to handle it.


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

Branch: refs/heads/develop
Commit: d3bdb68b8e5c881b42e285d9e5bdc46ed07f6c71
Parents: e865b35
Author: Darrel Schneider dschnei...@pivotal.io
Authored: Thu Aug 13 16:16:43 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:03 2015 -0700

--
 .../gemfire/internal/cache/partitioned/GetMessage.java | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d3bdb68b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/GetMessage.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/GetMessage.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/GetMessage.java
index c8d990d..64cbccd 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/GetMessage.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/GetMessage.java
@@ -129,6 +129,12 @@ public final class GetMessage extends 
PartitionMessageWithDirectReply
   return DistributionManager.PARTITIONED_REGION_EXECUTOR;
 }
   } catch (PRLocallyDestroyedException ignore) {
+  } catch (RuntimeException ignore) {
+// fix for GEODE-216
+// Most likely here would be RegionDestroyedException or 
CacheClosedException
+// but the cancel criteria code can throw any RuntimeException.
+// In all these cases it is ok to just fall through and return the
+// old executor type.
   }
 }
 if (forceUseOfPRExecutor) {



[10/12] incubator-geode git commit: GEODE-228: fix intermittent failures in NanoTimer tests

2015-08-19 Thread klund
GEODE-228: fix intermittent failures in NanoTimer tests

- NanoTimer2JUnitTest has been removed since it was an old
test that has been replaced by NanoTimerJUnitTest.
- NanoTimer can now be constructed with a TimeService.
 This allows unit tests to insert a different clock.
- NanoTimerJUnitTest now uses its own TimeService when
testing NanoTimer which prevents intermittent failures.


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

Branch: refs/heads/develop
Commit: f246c7f7bcc662f681dc1abcf109db993f9fad6c
Parents: 83029e0
Author: Darrel Schneider dschnei...@pivotal.io
Authored: Wed Aug 19 10:46:59 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:06 2015 -0700

--
 .../gemstone/gemfire/internal/NanoTimer.java|  37 +-
 .../gemfire/internal/NanoTimer2JUnitTest.java   |  79 
 .../gemfire/internal/NanoTimerJUnitTest.java| 121 +--
 3 files changed, 88 insertions(+), 149 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f246c7f7/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
index d0055dd..f9a04ed 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
@@ -48,11 +48,30 @@ public final class NanoTimer {
*/
   private long lastResetTime;
   
+  private final TimeService timeService;
+  
+  private final static TimeService systemTimeService = new TimeService() {
+@Override
+public long getTime() {
+  return java.lang.System.nanoTime();
+}
+  };
+  
   /**
* Create a NanoTimer.
*/
   public NanoTimer() {
-this.lastResetTime = getTime();
+this.timeService = systemTimeService;
+this.lastResetTime = systemTimeService.getTime();
+this.constructionTime = this.lastResetTime;
+  }
+  
+  /**
+   * For unit testing
+   */
+  NanoTimer(TimeService ts) {
+this.timeService = ts;
+this.lastResetTime = ts.getTime();
 this.constructionTime = this.lastResetTime;
   }
 
@@ -121,7 +140,7 @@ public final class NanoTimer {
*/
   public long reset() {
 long save = this.lastResetTime;
-this.lastResetTime = getTime();
+this.lastResetTime = this.timeService.getTime();
 return this.lastResetTime - save;
   }
 
@@ -132,7 +151,7 @@ public final class NanoTimer {
* @return time in nanoseconds since construction or last reset.
*/
   public long getTimeSinceReset() {
-return getTime() - this.lastResetTime;
+return this.timeService.getTime() - this.lastResetTime;
   }
 
   /**
@@ -142,7 +161,17 @@ public final class NanoTimer {
* @return time in nanoseconds since construction.
*/
   public long getTimeSinceConstruction() {
-return getTime() - this.constructionTime;
+return this.timeService.getTime() - this.constructionTime;
+  }
+  
+  /**
+   * Allows unit tests to insert a deterministic clock for testing.
+   */
+  interface TimeService {
+/**
+ * Returns the current time.
+ */
+public long getTime();
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f246c7f7/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
deleted file mode 100644
index fe243fb..000
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*=
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=
- */
-package com.gemstone.gemfire.internal;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import junit.framework.*;
-
-/**
- * Unit tests for NanoTimer
- */
-@Category(UnitTest.class)
-public class NanoTimer2JUnitTest extends 

[02/12] incubator-geode git commit: GEODE-196: Remove unneeded system out in RuntimeIterator

2015-08-19 Thread klund
GEODE-196: Remove unneeded system out in RuntimeIterator


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

Branch: refs/heads/develop
Commit: 751f2e9bed032da5ae2564d7ffaf133423b86b4c
Parents: 68b2124
Author: Jason Huynh jhu...@pivotal.io
Authored: Thu Aug 13 11:13:51 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:01 2015 -0700

--
 .../gemstone/gemfire/cache/query/internal/RuntimeIterator.java| 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/751f2e9b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/RuntimeIterator.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/RuntimeIterator.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/RuntimeIterator.java
index 5b3944a..6bf0da2 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/RuntimeIterator.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/RuntimeIterator.java
@@ -137,9 +137,6 @@ public class RuntimeIterator extends AbstractCompiledValue  
{
   }
 
   public Object evaluate(ExecutionContext context) {
-if(current == UNINITIALIZED) {
-  System.out.println(asif);
-}
 Support.Assert(current != UNINITIALIZED,
 error to evaluate RuntimeIterator without setting current first);
 return this.current;



[08/12] incubator-geode git commit: GEODE-220: Use wait after off-heap destroyRegion

2015-08-19 Thread klund
GEODE-220: Use wait after off-heap destroyRegion


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

Branch: refs/heads/develop
Commit: 96e889ee9fea560d92b33b1b0336369a42032847
Parents: 57c5247
Author: Darrel Schneider dschnei...@pivotal.io
Authored: Fri Aug 14 14:15:35 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:05 2015 -0700

--
 .../gemstone/gemfire/cache30/MultiVMRegionTestCase.java | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/96e889ee/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index ecec932..c5e2821 100644
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -2323,8 +2323,16 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
   region.destroyRegion(arg);
   if (region.getAttributes().getOffHeap()  !(region instanceof 
PartitionedRegion)) {
 GemFireCacheImpl gfc = (GemFireCacheImpl) getCache();
-SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) 
gfc.getOffHeapStore();
-assertEquals(0, ma.getStats().getObjects());
+final SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) 
gfc.getOffHeapStore();
+WaitCriterion waitForStatChange = new WaitCriterion() {
+  public boolean done() {
+return ma.getStats().getObjects() == 0;
+  }
+  public String description() {
+return never saw off-heap object count go to zero. Last value 
was  + ma.getStats().getObjects();
+  }
+};
+DistributedTestCase.waitForCriterion(waitForStatChange, 3000, 10, 
true);
   }
 }
   });



[09/12] incubator-geode git commit: GEODE-223: Handle region create/destroy remote event in Redis adpater

2015-08-19 Thread klund
GEODE-223: Handle region create/destroy remote event in Redis adpater

Ignore events where region creation initiated remotely attempts to create a 
local region reference when the region has already been destroyed. Also, the 
destruction of a region may be caught the query engine, so I have accounted for 
that by handling com.gemstone.gemfire.cache.query.RegionNotFoundException. 
Finally, a the Jedis client timeout has been increased for RedisDistDunitTest 
to account for concurrent region creation/destruction and an expected exception 
has been added to not fail over the log scanning. Sometimes when a region is 
destroyed the PooledMessage Processor will log a regiondestroyed exception, 
which is ok, but makes the test fail.

closes #16


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

Branch: refs/heads/develop
Commit: 83029e0e6c9e367ab9297f38c0d54a4f8d8ebbe6
Parents: 96e889e
Author: Vito Gavrilov vgavri...@pivotal.io
Authored: Mon Aug 17 18:30:12 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:06 2015 -0700

--
 .../internal/redis/ExecutionHandlerContext.java  |  3 ++-
 .../gemfire/internal/redis/RegionProvider.java   | 11 ---
 .../gemstone/gemfire/redis/GemFireRedisServer.java   | 11 ---
 .../gemstone/gemfire/redis/RedisDistDUnitTest.java   | 15 +--
 4 files changed, 27 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/83029e0e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/ExecutionHandlerContext.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/ExecutionHandlerContext.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/ExecutionHandlerContext.java
index cf20ea8..d2d2f51 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/ExecutionHandlerContext.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/ExecutionHandlerContext.java
@@ -22,6 +22,7 @@ import com.gemstone.gemfire.cache.TransactionException;
 import com.gemstone.gemfire.cache.TransactionId;
 import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException;
 import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
 import 
com.gemstone.gemfire.internal.redis.executor.transactions.TransactionExecutor;
 import com.gemstone.gemfire.redis.GemFireRedisServer;
 
@@ -213,7 +214,7 @@ public class ExecutionHandlerContext extends 
ChannelInboundHandlerAdapter {
 return;
   } catch (Exception e) {
 cause = e;
-if (e instanceof RegionDestroyedException || e.getCause() instanceof 
QueryInvocationTargetException)
+if (e instanceof RegionDestroyedException || e instanceof 
RegionNotFoundException || e.getCause() instanceof 
QueryInvocationTargetException)
   Thread.sleep(WAIT_REGION_DSTRYD_MILLIS);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/83029e0e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java
index a95f853..cadaf5f 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/redis/RegionProvider.java
@@ -194,7 +194,7 @@ public class RegionProvider implements Closeable {
 return getOrCreateRegion0(key, type, context, true);
   }
 
-  public void createRemoteRegionLocally(ByteArrayWrapper key, RedisDataType 
type) {
+  public void createRemoteRegionReferenceLocally(ByteArrayWrapper key, 
RedisDataType type) {
 if (type == null || type == RedisDataType.REDIS_STRING || type == 
RedisDataType.REDIS_HLL)
   return;
 Region?, ? r = this.regions.get(key);
@@ -210,11 +210,16 @@ public class RegionProvider implements Closeable {
   boolean locked = false;
   try {
 locked = lock.tryLock();
-// If we cannot get the lock then this remote even may have been 
initialized
+// If we cannot get the lock then this remote event may have been 
initialized
 // independently on this machine, so if we wait on the lock it is more 
than
-// likely we will deadlock just to do the same task, this 

[05/12] incubator-geode git commit: GEODE-209: Change subTearDown to destroy process

2015-08-19 Thread klund
GEODE-209: Change subTearDown to destroy process


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

Branch: refs/heads/develop
Commit: abb11d3a9d4fdb9462aa23cc54577eb27b032a6a
Parents: d3bdb68
Author: Kirk Lund kl...@pivotal.io
Authored: Thu Aug 13 13:22:02 2015 -0700
Committer: Kirk Lund kl...@pivotal.io
Committed: Wed Aug 19 16:08:03 2015 -0700

--
 .../golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java| 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/abb11d3a/gemfire-core/src/test/java/com/gemstone/gemfire/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
index 1b8a312..bd55e6b 100755
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
@@ -16,8 +16,7 @@ public class FailWithTimeoutOfWaitForOutputToMatchJUnitTest 
extends FailOutputTe
   private ProcessWrapper process;
   
   public void subTearDown() throws Exception {
-this.process.waitFor();
-assertFalse(this.process.isAlive());
+this.process.destroy();
   }
   
   @Override



[01/12] incubator-geode git commit: Fix JMX Http manager incorrectly treating 'start gateway-sender' endpoint as 'start gateway-receiver'

2015-08-19 Thread klund
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 9efe74e4c - bbc2a5fa5


Fix JMX Http manager incorrectly treating 'start gateway-sender' endpoint as 
'start gateway-receiver'


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

Branch: refs/heads/develop
Commit: 65e969439e3c03f5557b2e1adc609c97544ecb2b
Parents: 9de95d6
Author: Vito Gavrilov vgavri...@pivotal.io
Authored: Wed Aug 12 13:13:55 2015 -0700
Committer: Vito Gavrilov vgavri...@pivotal.io
Committed: Wed Aug 12 13:13:55 2015 -0700

--
 .../management/internal/web/controllers/WanCommandsController.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/65e96943/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsController.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsController.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsController.java
index 1e22bd9..97f9bbe 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsController.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsController.java
@@ -298,7 +298,7 @@ public class WanCommandsController extends 
AbstractCommandsController {
@RequestParam(value = 
CliStrings.START_GATEWAYSENDER__GROUP, required = false) final String[] groups,
@RequestParam(value = 
CliStrings.START_GATEWAYSENDER__MEMBER, required = false) final String[] 
members)
   {
-CommandStringBuilder command = new 
CommandStringBuilder(CliStrings.START_GATEWAYRECEIVER);
+CommandStringBuilder command = new 
CommandStringBuilder(CliStrings.START_GATEWAYSENDER);
 
 command.addOption(CliStrings.START_GATEWAYSENDER__ID, gatewaySenderId);
 



incubator-geode git commit: GEODE-229: Fixed javadoc for DiskStoreFactory.setCompactionThreshold

2015-08-19 Thread upthewaterspout
Repository: incubator-geode
Updated Branches:
  refs/heads/develop bbc2a5fa5 - 936065f41


GEODE-229: Fixed javadoc for DiskStoreFactory.setCompactionThreshold

The javadocs and the behavior of the code were backwards. The code
compacts when the live data gets below the threshold. I changed the
javadocs to avoid screwing up someone who was relied on the old
behavior.

Adding a unit test of this property.


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

Branch: refs/heads/develop
Commit: 936065f4194f5df97d83b26ca029e66bb69a8d15
Parents: bbc2a5f
Author: Dan Smith upthewatersp...@apache.org
Authored: Tue Aug 18 17:54:56 2015 -0700
Committer: Dan Smith upthewatersp...@apache.org
Committed: Wed Aug 19 16:35:27 2015 -0700

--
 .../gemfire/cache/DiskStoreFactory.java | 15 ++
 .../internal/cache/DiskRegionJUnitTest.java | 30 
 2 files changed, 39 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/936065f4/gemfire-core/src/main/java/com/gemstone/gemfire/cache/DiskStoreFactory.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/DiskStoreFactory.java 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/DiskStoreFactory.java
index ab67c75..296fb8a 100755
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/DiskStoreFactory.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/DiskStoreFactory.java
@@ -111,13 +111,16 @@ public interface DiskStoreFactory
   public DiskStoreFactory setAutoCompact(boolean isAutoCompact);
 
   /**
-   * Sets the threshold at which an oplog will become compactable. Until it 
reaches
-   * this threshold the oplog will not be compacted.
-   * The threshold is a percentage in the range 0..100.
-   * When the amount of garbage in an oplog exceeds this percentage then when 
a compaction
-   * is done this garbage will be cleaned up freeing up disk space. Garbage is 
created by
+   * Sets the threshold at which an oplog will become compactable. Until it
+   * reaches this threshold the oplog will not be compacted. The threshold is a
+   * percentage in the range 0..100. When the amount of live data in an oplog
+   * becomes less than this percentage then when a compaction is done this
+   * garbage will be cleaned up freeing up disk space. Garbage is created by
* entry destroys, entry updates, and region destroys.
-   * @param compactionThreshold the threshold percentage at which an oplog is 
compactable
+   * 
+   * @param compactionThreshold
+   *  percentage of remaining live data in the oplog at which an oplog
+   *  is compactable
* @return a reference to codethis/code
*/
   public DiskStoreFactory setCompactionThreshold(int compactionThreshold);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/936065f4/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionJUnitTest.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionJUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionJUnitTest.java
index bfc832a..9f85b6f 100755
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionJUnitTest.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionJUnitTest.java
@@ -2993,6 +2993,36 @@ public class DiskRegionJUnitTest extends 
DiskRegionTestingBase
 boolean compacted = ((LocalRegion)region).getDiskStore().forceCompaction();
 assertEquals(true, compacted);
   }
+  
+  /**
+   * Confirm that forceCompaction waits for the compaction to finish
+   */
+  @Test
+  public void testNonDefaultCompaction() {
+DiskRegionProperties props = new DiskRegionProperties();
+props.setRegionName(testForceCompactionDoesRoll);
+props.setRolling(false);
+props.setDiskDirs(dirs);
+props.setAllowForceCompaction(true);
+props.setPersistBackup(true);
+props.setCompactionThreshold(90);
+region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, props, 
Scope.LOCAL);
+DiskRegion dr = ((LocalRegion)region).getDiskRegion();
+logWriter.info(putting key1);
+region.put(key1, value1);
+logWriter.info(putting key2);
+region.put(key2, value2);
+//Only remove 1 of the entries. This wouldn't trigger compaction with
+//the default threshold, since there are two entries.
+logWriter.info(removing key1);
+region.remove(key1);
+// 

incubator-geode git commit: GEODE-77: improve restart locator error handling on corrupted state file

2015-08-19 Thread qihong
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-77 c61fe3466 - 7fd67b883


GEODE-77: improve restart locator error handling on corrupted state file


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

Branch: refs/heads/feature/GEODE-77
Commit: 7fd67b8836b1c0ff95034a9a6f25901e805354f2
Parents: c61fe34
Author: Qihong Chen qc...@pivotal.io
Authored: Wed Aug 19 15:12:16 2015 -0700
Committer: Qihong Chen qc...@pivotal.io
Committed: Wed Aug 19 15:13:06 2015 -0700

--
 gemfire-assembly/build.gradle   |  2 +-
 .../distributed/internal/InternalLocator.java   |  7 +-
 .../membership/gms/locator/GMSLocator.java  | 66 ++-
 .../gemfire/internal/i18n/LocalizedStrings.java |  2 +-
 .../gms/locator/GMSLocatorJUnitTest.java| 87 
 5 files changed, 118 insertions(+), 46 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7fd67b88/gemfire-assembly/build.gradle
--
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index 7e7dcb3..be655e2 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -112,7 +112,7 @@ def cp = {
   it.contains('spring-shell') ||
   it.contains('snappy-java') ||
   it.contains('hbase') ||
-  it.contains('jgroups')
+  it.contains('jgroups') ||
   it.contains('netty')
 }.join(' ') 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7fd67b88/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
index f649713..32dee46 100644
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
@@ -24,6 +24,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import com.gemstone.gemfire.InternalGemFireException;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.CancelException;
@@ -1066,7 +1067,7 @@ public class InternalLocator extends Locator implements 
ConnectListener {
 ThreadGroup group = LoggingThreadGroup.createThreadGroup(Locator restart 
thread group);
 this.restartThread = new Thread(group, Location services restart thread) 
{
   public void run() {
-boolean restarted;
+boolean restarted = false;
 try {
   restarted = attemptReconnect();
   logger.info(attemptReconnect returned {}, restarted);
@@ -1074,6 +1075,10 @@ public class InternalLocator extends Locator implements 
ConnectListener {
   logger.info(attempt to restart location services was interrupted, 
e);
 } catch (IOException e) {
   logger.info(attempt to restart location services terminated, e);
+} finally {
+  if (! restarted) {
+stoppedForReconnect = false;
+  }
 }
 InternalLocator.this.restartThread = null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7fd67b88/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
index a988dec..dd4ac51 100755
--- 
a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
+++ 
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocator.java
@@ -14,6 +14,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import com.gemstone.gemfire.InternalGemFireException;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.DataSerializer;
@@ -30,16 +31,16 @@ import 
com.gemstone.gemfire.distributed.internal.membership.gms.Services;
 import 
com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Locator;
 import 
com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
 

incubator-geode git commit: GEODE-228: fix intermittent failures in NanoTimer tests

2015-08-19 Thread dschneider
Repository: incubator-geode
Updated Branches:
  refs/heads/develop ff9b2f05f - 9efe74e4c


GEODE-228: fix intermittent failures in NanoTimer tests

- NanoTimer2JUnitTest has been removed since it was an old
test that has been replaced by NanoTimerJUnitTest.
- NanoTimer can now be constructed with a TimeService.
 This allows unit tests to insert a different clock.
- NanoTimerJUnitTest now uses its own TimeService when
testing NanoTimer which prevents intermittent failures.


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

Branch: refs/heads/develop
Commit: 9efe74e4cfc8e7130b538cd67b9ec315c5fcec7a
Parents: ff9b2f0
Author: Darrel Schneider dschnei...@pivotal.io
Authored: Wed Aug 19 10:46:59 2015 -0700
Committer: Darrel Schneider dschnei...@pivotal.io
Committed: Wed Aug 19 14:07:33 2015 -0700

--
 .../gemstone/gemfire/internal/NanoTimer.java|  37 +-
 .../gemfire/internal/NanoTimer2JUnitTest.java   |  79 
 .../gemfire/internal/NanoTimerJUnitTest.java| 121 +--
 3 files changed, 88 insertions(+), 149 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9efe74e4/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
--
diff --git 
a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java 
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
index d0055dd..f9a04ed 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/NanoTimer.java
@@ -48,11 +48,30 @@ public final class NanoTimer {
*/
   private long lastResetTime;
   
+  private final TimeService timeService;
+  
+  private final static TimeService systemTimeService = new TimeService() {
+@Override
+public long getTime() {
+  return java.lang.System.nanoTime();
+}
+  };
+  
   /**
* Create a NanoTimer.
*/
   public NanoTimer() {
-this.lastResetTime = getTime();
+this.timeService = systemTimeService;
+this.lastResetTime = systemTimeService.getTime();
+this.constructionTime = this.lastResetTime;
+  }
+  
+  /**
+   * For unit testing
+   */
+  NanoTimer(TimeService ts) {
+this.timeService = ts;
+this.lastResetTime = ts.getTime();
 this.constructionTime = this.lastResetTime;
   }
 
@@ -121,7 +140,7 @@ public final class NanoTimer {
*/
   public long reset() {
 long save = this.lastResetTime;
-this.lastResetTime = getTime();
+this.lastResetTime = this.timeService.getTime();
 return this.lastResetTime - save;
   }
 
@@ -132,7 +151,7 @@ public final class NanoTimer {
* @return time in nanoseconds since construction or last reset.
*/
   public long getTimeSinceReset() {
-return getTime() - this.lastResetTime;
+return this.timeService.getTime() - this.lastResetTime;
   }
 
   /**
@@ -142,7 +161,17 @@ public final class NanoTimer {
* @return time in nanoseconds since construction.
*/
   public long getTimeSinceConstruction() {
-return getTime() - this.constructionTime;
+return this.timeService.getTime() - this.constructionTime;
+  }
+  
+  /**
+   * Allows unit tests to insert a deterministic clock for testing.
+   */
+  interface TimeService {
+/**
+ * Returns the current time.
+ */
+public long getTime();
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9efe74e4/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
--
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
deleted file mode 100644
index fe243fb..000
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/NanoTimer2JUnitTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*=
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=
- */
-package com.gemstone.gemfire.internal;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import junit.framework.*;
-
-/**
- *