[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-develop
Subject:    [HtmlUnit] SVN: [8427] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/
From:       rbri () users ! sourceforge ! net
Date:       2013-07-31 19:26:20
Message-ID: E1V4c2U-000332-5Y () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 8427
          http://sourceforge.net/p/htmlunit/code/8427
Author:   rbri
Date:     2013-07-31 19:26:19 +0000 (Wed, 31 Jul 2013)
Log Message:
-----------
use ConcurrentHashMap instead of HashMap to avoid deadlocks when getting entries from \
different threads Issue 1530

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java


Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java
 ===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java	2013-07-27 \
                09:15:21 UTC (rev 8426)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java	2013-07-31 \
19:26:19 UTC (rev 8427) @@ -34,13 +34,13 @@
 import java.text.MessageFormat;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -248,9 +248,9 @@
         Pattern.compile("(top|bottom|center)\\s*(\\d+\\s*(%|px|cm|mm|in|pt|pc|em|ex)|left|right|center)");
  
     private static final Log LOG = LogFactory.getLog(CSSStyleDeclaration.class);
-    private static final Map<String, String> CSSColors_ = new HashMap<String, \
                String>();
-    private static final Map<String, String> CamelizeCache_ = new HashMap<String, \
                String>();
-    private static final Map<String, Integer> pixelValuesCache_ = new \
HashMap<String, Integer>(); +    private static final Map<String, String> CSSColors_ \
= new ConcurrentHashMap<String, String>(); +    private static final Map<String, \
String> CamelizeCache_ = new ConcurrentHashMap<String, String>(1000); +    private \
static final Map<String, Integer> PixelValuesCache_ = new ConcurrentHashMap<String, \
Integer>(1000);  
     /** The different types of shorthand values. */
     private enum Shorthand {
@@ -4335,7 +4335,7 @@
      * @see #pixelValue(HTMLElement, CssValue)
      */
     protected static int pixelValue(final String value) {
-        final Integer result = pixelValuesCache_.get(value);
+        final Integer result = PixelValuesCache_.get(value);
         if (null != result) {
             return result.intValue();
         }
@@ -4366,7 +4366,7 @@
             i = i * 24;
         }
 
-        pixelValuesCache_.put(value, Integer.valueOf(i));
+        PixelValuesCache_.put(value, Integer.valueOf(i));
         return i;
     }
 


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic