My RMI enabled application seems to be leaking sockets. I have a Java application providing a service over RMI. It is using the Java SE 1.6 RMI implementation running on Linux
public class MySocketFactorySettingKeepAlive ... {
// overwrite createSocket methods, call super.createSocket, add keepAlive
}
Socket.setSocketImplFactory(youFactoryDemandingKeepAlive);
and then just use RMI.
The trick, if I remember right, is to manage to set the factory before the system opens first socket -- Java disallows to overwrite the factory; in worst case, use reflection to overwrite it :))) (kidding; would be a hack)
Also, you may need to allow specific operation in SecurityManager.