PHOENIX-1963 - Irregular failures in ResultTest#testMonitorResult

Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/289a875b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/289a875b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/289a875b

Branch: refs/heads/json
Commit: 289a875bd1cd76b6437ae1400d6c324bfe3e0754
Parents: a1032fb
Author: cmarcel <cmar...@salesforce.com>
Authored: Thu May 14 15:56:46 2015 -0700
Committer: cmarcel <cmar...@salesforce.com>
Committed: Thu May 14 15:57:00 2015 -0700

----------------------------------------------------------------------
 phoenix-pherf/cluster/pherf.sh                                  | 2 +-
 .../main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java  | 5 ++---
 .../src/test/java/org/apache/phoenix/pherf/ResultTest.java      | 4 ++--
 phoenix-pherf/standalone/pherf.sh                               | 2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/cluster/pherf.sh
----------------------------------------------------------------------
diff --git a/phoenix-pherf/cluster/pherf.sh b/phoenix-pherf/cluster/pherf.sh
index aeff856..8d58dfe 100755
--- a/phoenix-pherf/cluster/pherf.sh
+++ b/phoenix-pherf/cluster/pherf.sh
@@ -28,6 +28,6 @@ for f in $PHERF_HOME/lib/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
 done
 
-CMD="time $}JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
+CMD="time ${JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
 
 eval $CMD
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
----------------------------------------------------------------------
diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
index 9f46cf7..6f97551 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/jmx/MonitorManager.java
@@ -106,8 +106,9 @@ public class MonitorManager implements Runnable {
                         rowCount.getAndIncrement();
                     }
                     try {
+                        resultHandler.flush();
                         Thread.sleep(getMonitorFrequency());
-                    } catch (InterruptedException e) {
+                    } catch (Exception e) {
                         Thread.currentThread().interrupt();
                         e.printStackTrace();
                     }
@@ -117,9 +118,7 @@ public class MonitorManager implements Runnable {
             try {
                 isRunning = false;
                 if (resultHandler != null) {
-                    resultHandler.flush();
                     resultHandler.close();
-
                 }
             } catch (Exception e) {
                 throw new FileLoaderRuntimeException("Could not close monitor 
results.", e);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
----------------------------------------------------------------------
diff --git 
a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java 
b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
index 0f4dfd1..c51f0dc 100644
--- a/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
+++ b/phoenix-pherf/src/test/java/org/apache/phoenix/pherf/ResultTest.java
@@ -55,7 +55,7 @@ public class ResultTest {
             resultMonitorWriter.write(result);
             resultMonitorWriter.write(result);
             resultMonitorWriter.write(result);
-            resultMonitorWriter.flush();
+            resultMonitorWriter.close();
             List<Result> results = resultMonitorWriter.read();
             assertEquals("Results did not contain row.", results.size(), 3);
 
@@ -72,7 +72,7 @@ public class ResultTest {
         ExecutorService executorService = Executors.newFixedThreadPool(1);
         MonitorManager monitor = new MonitorManager(100);
         Future future = executorService.submit(monitor);
-        List<Result> records = null;
+        List<Result> records;
         final int TIMEOUT = 30;
 
         int ct = 0;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/289a875b/phoenix-pherf/standalone/pherf.sh
----------------------------------------------------------------------
diff --git a/phoenix-pherf/standalone/pherf.sh 
b/phoenix-pherf/standalone/pherf.sh
index e08035a..2b91d2c 100755
--- a/phoenix-pherf/standalone/pherf.sh
+++ b/phoenix-pherf/standalone/pherf.sh
@@ -24,5 +24,5 @@ for f in $PHERF_HOME/lib/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
 done
 
-CMD="time $}JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
+CMD="time ${JAVA_HOME}/bin/java ${REMOTE_DEBUG} -Dapp.home=${PHERF_HOME} 
${ENV_PROPS} -Xms512m -Xmx3072m -cp ${CLASSPATH} org.apache.phoenix.pherf.Pherf 
${@}"
 eval $CMD
\ No newline at end of file

Reply via email to