FYI, I got a deadlock with Xalan 1.2.2 on one of our production
systems. (I know Xalan 1.2.2 isn't supported anymore, but we use
cocoon.) This is with Sun's Java 1.3.1 on a 4-way Solaris box.
Basically, the issue is:
* xalan synchronizes on locale before calling NumberFormat.getInstance().
* NumberFormat has a synchronizes on a hash, then calls Locale.hashCode()
which synchronizes on the locale object.
So if somebody else calls NumberFormat.getInstance() while xalan has
the lock on the locale but before it gets the lock on NumberFormat's
hash.
Relevent portions of the thread dump:
"Thread-29" prio=5 tid=0x501ae0 nid=0x53 waiting for monitor entry
[0xe6480000..0xe6481a28]
at java.util.Locale.hashCode(Locale.java:862)
at java.util.Hashtable.get(Hashtable.java:320)
at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols.java:338)
at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:60)
at java.text.NumberFormat.getInstance(NumberFormat.java:570)
at java.text.NumberFormat.getInstance(NumberFormat.java:329)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:332)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:281)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:269)
"Thread-27" prio=5 tid=0x500520 nid=0x51 waiting for monitor entry
[0xe667d000..0xe6681a28]
at java.util.Hashtable.get(Hashtable.java:319)
at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols.java:338)
at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:60)
at java.text.NumberFormat.getInstance(NumberFormat.java:570)
at java.text.NumberFormat.getNumberInstance(NumberFormat.java:343)
at org.apache.xalan.xslt.ElemNumber.getNumberFormatter(ElemNumber.java:663)
at org.apache.xalan.xslt.ElemNumber.getFormattedNumber(ElemNumber.java:841)
at org.apache.xalan.xslt.ElemNumber.formatNumberList(ElemNumber.java:803)