Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for the timeout properties of native java CORBA on the client-side

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 :)

like image 342
abdelrahman-sinno Avatar asked Jun 20 '13 10:06

abdelrahman-sinno


2 Answers

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:

  • TRANSPORT_TCP_TIMEOUTS_PROPERTY

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.

  • TRANSPORT_TCP_CONNECT_TIMEOUTS_PROPERTY

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.

  • WAIT_FOR_RESPONSE_TIMEOUT

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:

  • initial is the first timeout in milliseconds
  • max is the maximum wait time (before the last wait, which can go over this time) in milliseconds
  • backoff is the backoff factor by which the timeout is increased each time (the multiplication is actually by (backoff+100)/100, so 20 is 1.2 and 100 is 2, but we avoid any use of floating point here). This should normally be somewhere between 10 and 100.
  • maxsingle is the maximum single wait time. This is optional, and defaults to Integer.MAX_VALUE if not defined.

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.

like image 189
salocinx Avatar answered Nov 08 '22 12:11

salocinx


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.

like image 3
zellus Avatar answered Nov 08 '22 12:11

zellus