RuntimeException While Sending message in high load

Solution Unverified - Updated -

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.1.2

Issue

  • While sending large number of messages to Hornetq queue, the MDB throws the following exception:
java.lang.RuntimeException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
    at java.util.HashMap$EntryIterator.next(HashMap.java:834)
    at java.util.HashMap$EntryIterator.next(HashMap.java:832)
    at java.util.HashMap.writeObject(HashMap.java:999)
    at sun.reflect.GeneratedMethodAccessor341.invoke(Unknown Source)

Resolution

  • Need to synchronise the block or the method which is calling the send(message) method

Root Cause

  • The internal exception which HashMap throws is ConcurrentModificationException. This is caused when multiple threads are modifying the same Hashmap.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments