I have a java app which runs just fine (on Ubuntu 10.04) for few hours until it hits \"java.net.SocketException: Too many open files\". The code for Sender.java can be found
You might also want to check the linux maximum open file limit. This related link is for a bespoke java-based product but it nicely explains the steps required to fix the issue.