You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2016/01/07 07:32:52 UTC
svn commit: r1723468 - in /jmeter/trunk:
src/core/org/apache/jmeter/JMeter.java
src/core/org/apache/jmeter/gui/action/ActionRouter.java xdocs/changes.xml
Author: sebb
Date: Thu Jan 7 06:32:51 2016
New Revision: 1723468
URL: http://svn.apache.org/viewvc?rev=1723468&view=rev
Log:
Issue in CheckDirty and its relation to ActionRouter
Bugzilla Id: 58790
Modified:
jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1723468&r1=1723467&r2=1723468&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Thu Jan 7 06:32:51 2016
@@ -247,13 +247,15 @@ public class JMeter implements JMeterPlu
JMeterTreeModel treeModel = new JMeterTreeModel();
JMeterTreeListener treeLis = new JMeterTreeListener(treeModel);
- treeLis.setActionHandler(ActionRouter.getInstance());
+ final ActionRouter instance = ActionRouter.getInstance();
+ instance.populateCommandMap();
+ treeLis.setActionHandler(instance);
// NOTUSED: GuiPackage guiPack =
GuiPackage.getInstance(treeLis, treeModel);
MainFrame main = new MainFrame(treeModel, treeLis);
ComponentUtil.centerComponentInWindow(main, 80);
main.setVisible(true);
- ActionRouter.getInstance().actionPerformed(new ActionEvent(main, 1, ActionNames.ADD_ALL));
+ instance.actionPerformed(new ActionEvent(main, 1, ActionNames.ADD_ALL));
if (testFile != null) {
try {
File f = new File(testFile);
Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java?rev=1723468&r1=1723467&r2=1723468&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java Thu Jan 7 06:32:51 2016
@@ -40,11 +40,10 @@ import org.apache.log.Logger;
public final class ActionRouter implements ActionListener {
private static final Logger log = LoggingManager.getLoggerForClass();
- private static final Object LOCK = new Object();
+ // This is cheap, so no need to resort to IODH or lazy init
+ private static final ActionRouter INSTANCE = new ActionRouter();
- private static volatile ActionRouter router;
-
- private Map<String, Set<Command>> commands = new HashMap<>();
+ private final Map<String, Set<Command>> commands = new HashMap<>();
private final Map<String, Set<ActionListener>> preActionListeners =
new HashMap<>();
@@ -284,7 +283,13 @@ public final class ActionRouter implemen
}
}
- private void populateCommandMap() {
+ /**
+ * Only for use by the JMeter.startGui
+ */
+ public void populateCommandMap() {
+ if (!commands.isEmpty()) {
+ return; // already done
+ }
try {
List<String> listClasses = ClassFinder.findClassesThatExtend(
JMeterUtils.getSearchPaths(), // strPathsOrJars - pathnames or jarfiles to search for classes
@@ -295,7 +300,6 @@ public final class ActionRouter implemen
// Ignore the classes which are specific to the reporting tool
"org.apache.jmeter.report.gui", // $NON-NLS-1$ // notContains - classname should not contain this string
false); // annotations - true if classnames are annotations
- commands = new HashMap<>(listClasses.size());
if (listClasses.isEmpty()) {
log.fatalError("!!!!!Uh-oh, didn't find any action handlers!!!!!");
throw new JMeterError("No action handlers found - check JMeterHome and libraries");
@@ -325,14 +329,6 @@ public final class ActionRouter implemen
* @return The Instance value
*/
public static ActionRouter getInstance() {
- if (router == null) {
- synchronized (LOCK) {
- if(router == null) {
- router = new ActionRouter();
- router.populateCommandMap();
- }
- }
- }
- return router;
+ return INSTANCE;
}
}
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1723468&r1=1723467&r2=1723468&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Jan 7 06:32:51 2016
@@ -166,6 +166,7 @@ Summary
<li><bug>58782</bug>ThreadGroup : Improve ergonomy</li>
<li><bug>58165</bug>Show the time elapsed since the start of the load test in GUI mode. Partly based on a contribution from Maxime Chassagneux (maxime.chassagneux at gmail.com)</li>
<li><bug>58784</bug>Make JMeterUtils#runSafe sync/async awt invocation configurable and change the visualizers to use the async version.</li>
+<li><bug>58790</bug>Issue in CheckDirty and its relation to ActionRouter</li>
</ul>
<ch_section>Non-functional changes</ch_section>
<ul>