Java RMI connection-pooling details

I´m working on a Java RMI topic and need some information about the connection pooling on the client side. In the literature and the documentation there are no clear answers to these topics. I know that connection pooling is not a part of the RMI specification. But in some implementations (e.g. in SUN´s implementation) it is done. So my questions refer to this implementation.

I suppose that the socket (java.net.Socket) which is created by the RMI socket factory is cached in the pool. Is that correct?

How are these connections saved? I would except that a HashMap is used with the destination ip/port as key and the socket as value.

Sockets are closed by using a timeout. How is the information on the connection idle time gained? Possibly there is some kind of timestamp when the connection is used the last time.

Answers


Bearing in mind that I am talking about the Sun implementation only:

I suppose that the socket (java.net.Socket) which is created by the RMI socket factory is cached in the pool. Is that correct?

Yes, after it is released from the remote call, and of course the remote call looks in the pool first before it asks the socket factory to create a new Socket.

How are these connections saved? I would except that a HashMap is used with the destination ip/port as key and the socket as value.

Let's just say there must logically be a Map from ip:port to Socket. The implementation details aren't actually important.

Sockets are closed by using a timeout. How is the information on the connection idle time gained?

By noting the time when the connection was put into the pool.


In Oracle/OpenJDK the List of (idle) connections to a certain endpoint (for a certain channel) is maintained in List<TCPConnectiont> sun.rmi.transport.tcp.TCPChannel#freeList. There is no maximum size. There is a reaper thread which checks sockets for being idle for longer than 15s (-Dsun.rmi.transport.connectionTimeout=15000).

The Channels are stored in Map<TCPEndpoint,Reference<TCPChannel>> sun.rmi.transport.tcp.TCPTransport#channelTable as a WeakHashMap.

There is BTW a possible (global) limit of processing threads (-Dsun.rmi.transport.tcp.maxConnectionThreads=unlimited) on the accepting side.


Need Your Help

UITableView does not responding to selection of UITableViewCell

ios iphone objective-c cocoa-touch uitableview

i have created a UItableView named _tableView, here is the code for table view in view.m