How can I increase the maximum number of requests that an RMI server can handle simultaneously. I am getting connection refused error after 25 request are made simultaneously from 25 threads in a client.

Edward Harned

Without knowing more of the details, you may be running into a temporary condition, (like a packet storm), where the receiver is overloaded. We use a retry loop for connection errors.

// try to connect this many times
int count = 10;

// keep trying the connection
while (count > 0) {
    try {
        ourRO = (OurRemoteObject)java.rmi.Naming.lookup(our_name);
        // got one

    catch(ConnectException e) {
    catch(Exception e) {
        // add your code here