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

2

9

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

Loquacity answered 20/6, 2013 at 10:35 Comment(3)
These properties aren't officially documented; they change from release to release; and their names are constructed dynamically in the source code. Good luck.Malaysia
Thanks a lot, that's really helpful.. No insult here, but that's very demotivating. I'm actually decompiling rt.jar to find this stuff !Loquacity
I am having the same issue... Whenever the client codes start reading from the server, it can wait indefinitely... Help :) ?Openmouthed
D
6

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.

Disappointment answered 14/10, 2014 at 8:46 Comment(1)
Appreciate the reply ! As I mentioned in a comment above, I had to use a library called jacORB which can handle the timeouts. Unfortunately I was stuck with the Sun JDK environment, not glassfish. Good to hear it worked out for you..Loquacity
L
3

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.

Leslee answered 6/9, 2013 at 12:56 Comment(1)
Thanks for the reply ! I had to use a library called jacORB which can handle the timeouts. As for your suggestion, I am doubting that the fix only works on Glassfish, cause I recall to have attempted setting System properties.. but it's been a very long time, and I'm not sure exactly which properties I've set..Loquacity

© 2022 - 2024 — McMap. All rights reserved.