Too Many Open Files

Hello,

I have a problem with my java application, It open, read, write and close a lot of file very rapidly, and when it arrive to the 990th file, it handle an IOException ( Too many open files).

The problem is I close ALL FILES and set them to null after closes it...

Did it exist a method to know which files are opened by the thread ?

Or perhaps I must closes "File" object with a method ? I just do close() to FileOutputStream and "=null;" to File instances...

thanks

[508 byte] By [NahuelAa] at [2007-10-2 17:13:54]
# 1
Are you sure you close the files? If you watch the java process with some process diagnostics utlity (task manager or ps command), do you see its holding many files open?
BIJ001a at 2007-7-13 18:29:18 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Yes i'm sure, i close all file,I used lsof to know which files are opened, and I find that was the socket connection to the remote host which was CLOSE_WAIT because I keep the same connection for all my class.Now I restart the connection each time and it works better.
NahuelAa at 2007-7-13 18:29:18 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
Under Unix open sockets (and pipes etc.) consume file descriptors.
BIJ001a at 2007-7-13 18:29:18 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...