Author: fschumacher
Date: Fri Mar 18 11:17:05 2016
New Revision: 1735574
URL: http://svn.apache.org/viewvc?rev=1735574&view=rev
Log:
Followup to r1733983
Ensure, that only one instance of a LinkExtractorParser gets cached, even if two
threads are creating one at the same time.
Bugzilla Id: 59033
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java?rev=1735574&r1=1735573&r2=1735574&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
(original)
+++
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
Fri Mar 18 11:17:05 2016
@@ -75,7 +75,12 @@ public abstract class BaseParser impleme
}
LOG.info("Created " + parserClassName);
if (parser.isReusable()) {
- PARSERS.put(parserClassName, parser);// cache the parser
+ LinkExtractorParser currentParser = PARSERS.putIfAbsent(
+ parserClassName, parser);// cache the parser if not alread
+ // done by another thread
+ if (currentParser != null) {
+ return currentParser;
+ }
}
return parser;