Author: sebb Date: Thu Nov 8 17:06:05 2007 New Revision: 593378 URL: http://svn.apache.org/viewvc?rev=593378&view=rev Log: HashMap is shared between threads, so accesses need to be synchronized
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java?rev=593378&r1=593377&r2=593378&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DOMPool.java Thu Nov 8 17:06:05 2007 @@ -36,7 +36,6 @@ * <p> * Created on: Jun 17, 2003<br> * - * @author Peter Lin */ public final class DOMPool { /** @@ -44,7 +43,7 @@ * test on an old system will likely run into memory or CPU problems long * before the HashMap is an issue. */ - private static HashMap MEMCACHE = new HashMap(50); + private static final HashMap MEMCACHE = new HashMap(50); /** * Return a document. @@ -52,7 +51,7 @@ * @param key * @return Document */ - public static Document getDocument(Object key) { + public static synchronized Document getDocument(Object key) { return (Document) MEMCACHE.get(key); } @@ -62,7 +61,7 @@ * @param key * @param data */ - public static void putDocument(Object key, Object data) { + public static synchronized void putDocument(Object key, Object data) { MEMCACHE.put(key, data); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]