How can an 'unsafe' SOA-P ESB Action class be made safe in the presence of multiple threads?

Solution Verified - Updated -

Environment

JBoss Enterprise SOA Platform (SOA-P) 5.x

Issue

SOA-P Action classes should be thread-safe, as only a single instance per Action is utilized. (So multiple listener threads will try to use this class at the same time, resulting in problems.) How can this be remedied?

Resolution

If performance can be slightly compromised, use of a 'synchronized' block in the Action class will protect the necessary resources.

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.