Troubleshooting and Limitations - Java Record Replay and Java Vuser

This section describes troubleshooting and limitations for the Java Vuser protocol and the Java Record Replay protocol.

Specifying connection timeouts

To set timeouts, add Java code to set the properties.

Example of setting RMI timeouts to 5 seconds:
import lrapi.lr;
public class Actions {
  public int init() throws Throwable {
    return 0;
  }
  public int action() throws Throwable {
    java.util.Properties properties=System.getProperties();
    
    properties.put("sun.rmi.transport.tcp.responseTimeout", 5000);
    properties.put("sun.rmi.transport.tcp.readTimeout", 5000); 
    properties.put("sun.rmi.transport.connectionTimeout", 5000);
    properties.put("sun.rmi.transport.handshakeTimeout", 5000);
   
    properties.put("user.script","");
    System.setProperties(properties);
    java.lang.String var_0="rmi://example.com/RmiServer";
    RmiServerIntf var_1=(RmiServerIntf)java.rmi.Naming.lookup(var_0);
    java.lang.String var_2=var_1.getMessage();
    return 0;
  }
  public int end() throws Throwable {
    return 0;
  }
}

To set this timeout to all TCP connections:

    properties.put("sun.net.client.defaultReadTimeout", 5000);
    properties.put("sun.net.client.defaultConnectTimeout", 5000);