I have a scenario where there is an Inbound Adapter with heavy inflow of messages.
There could be a scenario where all the MDBs are busy servicing the requests for previous messages, i might get additional messages coming in.
In This case we will have to wait till one of the MDB frees up from servicing the message so that the pending message can then be delivered it for servicing.
I have thought if using wait and notify for this purpose and implemented it as below.
1. The connections from the clients are long lived and the client continues to send the messages over the same connection. One thread will be listening to this socket and accept incoming messages. We will call this thread A.
2. Thread A then spawns another Thread to deliver the message to the endpoint, this is a short lived thread and will return after the message delivery is done. We will call this thread B.
I am not using Threads to handle this but Submitting Work to the WorkManager.
Below is the code for the run method of the Thread(Work) B
The above code looks ok to me but i am getting a lots of java.lang.IllegalMonitorException. Can anybody explain the reason for the same or suggest a better way to handle UnavailableException?
subject: Correctly handling javax.resource.spi.UnavailableException in an Inbound Connector