You probably know that the java.util collections are not thread-safe (with the exception of Vector).
Today I encountered a problem when 2 threads which each process their own asynchronous data stream write to the same static HashMap via a static method.
The problem exhibits itself as a code freeze on the threads involved but sending the kill -3 signal to the java pid (or the CTRL-Break if you are in a Windows command prompt) to get a thread dump does not identify any deadlocks.
The 2 threads involved both show themselves stuck in the HashMap.put() method.
The quick solution if you are using Java 1.5 or later is to substitute java.util.concurrent.ConcurrentHashMap for HashMap.
Leave comments, ask questions, or suggest improvements