Is there any limit on the time duration of an RMI call? Does RMI support timeouts?
When timing a request, the RMI Connection thread cannot time itself. If it gets caught in a long or never ending loop then it may not be able to break out of the code when the time expires. Therefore, it is necessary for the RMI Connection thread to start a new application thread. The RMI Connection thread may time the new thread and if the time expires the RMI Connection thread informs the calling client that the request cannot complete.
This seems simple enough. However, there are serious problems with this approach.
[Some developers may put the timing code in the client. Rather than have a standard timing mechanism on the server, each client application must add proprietary timing code.]
What happens to the threads that time-out? If there is problem with a resource that the threads require before completing, then, once again, there may come a time when the VM cannot sustain any more threads and the entire VM becomes unusable.
[Even with the timing code in the client, the RMI Connection threads still hang.] We have a commercial product that solves this problem.