Question

I have JBoss 5 with ejb3 beans deployed to it.

If bean method execution takes a very long time (I checked that for 2 hours), then the client does not receive the answer when the EJB method execution finishes (with exception or not).

The client is blocked waiting for response from socket.

Why does that happen?

Était-ce utile?

La solution

Most likely this is caused by a (stateful) router, packet filter, load balancer, SSL box whatever in between: They just terminate the connection after a certain time of inactivity, and the real endpoints are not notified. Experience shows that it's normally out of your control to have suitable timeouts in each device.

Anyway in your case, instead of curing the symptoms: A running request needs an open TCP connection, and possibly blocks a thread. So consider changing the design of your system from synchronous to asynchronous:

  • Use polling here, every minute should be enough. So you have a function to submit a task, and another one which returns "not yet ready" or "here is the result".
  • Use JMS queues in your client to submit tasks and to receive results
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top