I am using CORBA (ORB) which natively comes with Java, no third party libraries are used.
I'm in need of the CORBA client Properties for timeouts, in order set a timeout on the client's side and limit the amount of time which the connection stays open; it should be set for all scenarios, to limit the maximum request time:
Initializing connection
Rebinding a connection
The total request time
I am testing by putting a sleep on the Server (within the server method logic), and the client is not timing out at all.
It is very difficult to find the appropriate documentation on the web; I have attempted using all the below properties, to no avail:
aProperties.put("com.sun.CORBA.transport.ORBTCPReadTimeouts", "100:300:3000:20"); aProperties.put("com.sun.corba.eetransport.ORBTCPTimeouts", "500:2000:50:1000"); aProperties.put("com.sun.corba.ee.transport.ORBWaitForResponseTimeout", 10);
For more clarity, next to these properties (above) are set the Host and Port using properties org.omg.CORBA.ORBInitialHost and org.omg.CORBA.ORBInitialPort.
Any help is appreciated :)
Read this Oracle blog for more information about the time-outs. It helped me alot.
There are a number of ORB config parameters in com.sun.corba.ee.impl.orbutil.ORBConstants (note that this is the GlassFish ORB, not the JDK ORB). The constants relevant to transport timeouts are:
This controls the retry behavior when the ORB is reading data and does not get all of the data at once. It is an instance of TcpTimeouts. The defaults are 2000:6000:20.
This is the one relevant to this discussion. It controls how the ORB behaves on the client side when attempting to connect to an IOR (the wire rep of an EJB reference). This is also an instance of TcpTimeouts. The defaults are 250:60000:100:5000.
This controls how long the client waits for a response AFTER successfully sending a request. The default is 30 minutes. Both TcpTimeouts use the same syntax for configuration:
initial:max:backoff[:maxsingle] (a series of 3 or 4 positive decimal integers separated by :)
where:
This works as follows:
The first timeout last for initial milliseconds. Each subsequent timeout is obtained from the previous by multiplying by the backoff factor (as explained above) No timeout can exceed maxsingle milliseconds: once this value is reached, any subsequent timeouts have the same value. The total time spent before the last timeout is less than max. Note that the last timeout may cause the total time to exceed max.
I can confirm for glassfish 3.1.2.2 that the suggested solution in Some CORBA properties are ignored does work.
The required system properties may be set as java command parameters
java -Dcom.sun.corba.ee.transport.ORBWaitForResponseTimeout=5000 -Dcom.sun.corba.ee.transport.ORBTCPConnectTimeouts=100:500:100:500 -Dcom.sun.corba.ee.transport.ORBTCPTimeouts=500:2000:50:1000 -cp ..
or in your code with
System.setProperty("com.sun.corba.ee.transport.ORBWaitForResponseTimeout","5000");
It is mandatory to set the ORB parameters as system properties. They have no effect if used as Properties for the InitialContext.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With