I am using JDK 1.4.
The application runs on Linux and Windows.
I do know how to debug. I am using Log4J to help in debugging.
I do know I have a logic problem.
I have searched Google for "Too many files Open" for days for a resolution.
I have all Stream commands surrounded by a try catch with a finally closing
the stream.
This is a massive application and the problem could be anywhere, hence the
reason for tracing. There is really no code to post, because I don't know
where the problem lies.
I would just like to know if Java provides an API to determine your current
level of Open files e.g.,
Files.getCurrentOpenCount();
or
DatabaseConnection.getCurrentConnectionCount();
And if Java does provide such methods, is there a way to force the JVM to
close these lingering Opens.
> > I have a problem of getting the error "too many files open" and would like
> > to trace my application. However, I have found nothing about how to display
[quoted text clipped - 25 lines]
> 'If there is one, Knowledge is the "Fountain of Youth"'
> -William E. Taylor, Regular Guy (1952-)
Gordon Beaton - 19 Jun 2006 07:53 GMT
> The application runs on Linux and Windows.
[...]
> And if Java does provide such methods, is there a way to force the
> JVM to close these lingering Opens.
If you are holding references to these objects, the JVM cannot know
they are no longer necessary.
If you are no longer holding references to them, they may eventually
be garbage collected and finalized. Realize though that lack of file
descriptors will not trigger the garbage collector.
On Linux you can use lsof or do "ls -l" in /proc/<pid>/fd to see what
open descriptors any process is holding. You can also use ulimit to
raise the descriptor limit, but that's not a solution to the real
problem.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Tyrone Showers - 20 Jun 2006 05:58 GMT
Thanks for your answer.
> > The application runs on Linux and Windows.
>
[quoted text clipped - 16 lines]
>
> /gordon
Oliver Wong - 19 Jun 2006 19:00 GMT
> I would just like to know if Java provides an API to determine your
> current
[quoted text clipped - 8 lines]
> And if Java does provide such methods, is there a way to force the JVM to
> close these lingering Opens.
For your second question, the answer is "probably no". How would the JVM
differentiate between an open which is "lingering" and an open which is
"critical to the correct functioning of this application"?
- Oliver
Tyrone Showers - 20 Jun 2006 05:58 GMT
Thanks for your answer.
> > I would just like to know if Java provides an API to determine your
> > current
[quoted text clipped - 14 lines]
>
> - Oliver