Author: pmouawad
Date: Tue Jan 8 20:14:39 2019
New Revision: 1850790
URL: http://svn.apache.org/viewvc?rev=1850790&view=rev
Log:
Bug 63069 - ResultCollector does not write end of XML file if user exits while
a Recording or a test is running
Contributed by UbikLoadPack
Bugzilla Id: 63069
Modified:
jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java?rev=1850790&r1=1850789&r2=1850790&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java Tue
Jan 8 20:14:39 2019
@@ -69,9 +69,9 @@ public class ResultCollector extends Abs
private static class FileEntry{
final PrintWriter pw;
final SampleSaveConfiguration config;
- FileEntry(PrintWriter _pw, SampleSaveConfiguration _config){
- pw =_pw;
- config = _config;
+ FileEntry(PrintWriter printWriter, SampleSaveConfiguration
sampleSaveConfiguration){
+ this.pw = printWriter;
+ this.config = sampleSaveConfiguration;
}
}
@@ -81,7 +81,7 @@ public class ResultCollector extends Abs
public void run() {
log.info("Shutdown hook started");
synchronized (LOCK) {
- flushFileOutput();
+ finalizeFileOutput();
}
log.info("Shutdown hook ended");
}
@@ -300,6 +300,7 @@ public class ResultCollector extends Abs
log.warn("Should not happen: shutdownHook==null,
instanceCount={}", instanceCount);
}
finalizeFileOutput();
+ out = null;
inTest = false;
}
}
@@ -590,23 +591,8 @@ public class ResultCollector extends Abs
out.flush();
}
}
-
- /**
- * Flush PrintWriter, called by Shutdown Hook to ensure no data is lost
- */
- private static void flushFileOutput() {
- for(Map.Entry<String, ResultCollector.FileEntry> me :
files.entrySet()) {
- String key = me.getKey();
- ResultCollector.FileEntry value = me.getValue();
- log.debug("Flushing: {}", key);
- value.pw.flush();
- if (value.pw.checkError()){
- log.warn("Problem detected during use of {}", key);
- }
- }
- }
- private void finalizeFileOutput() {
+ private static void finalizeFileOutput() {
for(Map.Entry<String, ResultCollector.FileEntry> me :
files.entrySet()) {
String key = me.getKey();
ResultCollector.FileEntry value = me.getValue();
@@ -622,7 +608,6 @@ public class ResultCollector extends Abs
}
}
files.clear();
- out = null;
}
/**
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1850790&r1=1850789&r2=1850790&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Jan 8 20:14:39 2019
@@ -198,6 +198,7 @@ of previous time slot as a base. Startin
<h3>Listeners</h3>
<ul>
<li><bug>62770</bug>Aggregate Graph throws
<code>ArrayIndexOutOfBoundsException</code></li>
+ <li><bug>63069</bug>ResultCollector does not write end of XML file if user
exits while a Recording or a test is running. Contributed by Ubik Load Pack
(support at ubikloadpack.com)</li>
</ul>
<h3>Timers, Assertions, Config, Pre- & Post-Processors</h3>