How does ORBconnectionMaxIdle option work?

From Support
Jump to: navigation, search

Question:

How does ORBconnectionMaxIdle option work?

Answer:

NOTE: The ORBconnectionMaxIdle does not affect active connections.

When the (client side) ORB closes a connection, the connection is temporarily placed in a connection cache.  Every 30 seconds the garbage collection thread runs and reclaims resources.  One of the things that happens is that all connections in the cache are examined to see if they have been in the cache longer than the ORBconnectionMaxIdle time in seconds.  If so, then the connection is closed and removed from thecache.
NOTE: ORBgcTimeout acts as a minimum if it is larger than ORBconnectionMaxIdle because it controls how often the GarbageCollector thread attempts to reclaim resources.

The trick to seeing the affect of ORBconnectoinmaxIdle is to know how to force the ORB to first "close" the connection and place the connection in the cache.  Here are two ways to make this happen:

1) by setting and exceeding an OAconnectionMax.  This should force connections into the connection cache and later be closed when ORBconnectionMaxIdle is exceeded.

2) by allowing all references to all stubs that may use the connection to be garbage collected by the java VM. When the last stub using the connection is destroyed the connection should be moved to the connection
cache and later be closed when ORBconnectionMaxIdle is exceeded. This method is unpredictable since one can't really control when the java VM decides to finalize an object. You know that the last stub has been
finalized and the connection moved to the cache when the client ORBdebug shows a message "Caching connection: ...".

An easy way to test either of the above is to run the server(s) with ORBdebug turned on.  The server will print a debug message when the client closes the connection.

Another way to observe it is to start the server on a specific port and then monitor netstat output to see the state of the connection change from ESTABLISHED to some other state.

The example that illustrates how the option works can be downloaded from:
ftp://ftp4.inprise.com/private/ts/examples/ORBconnectionMaxIdle.tar

It contains source code as well as a README.txt file that describes what the example does and how it runs.



Article originally contributed by Borland Developer Support