0

我的应用程序在 Tomcat 5.5 上运行,它打开一个未关闭的文本文件,在打开一定数量的文件后,服​​务器挂起并抛出错误 java.io.IOException: Too many open files and works well 一旦我重新启动了 Tomcat,我找到了根本原因并使用 FileInputStream.close() 关闭了文本文件

任何人都可以帮我找到在服务器挂起之前打开的文件数。

4

1 回答 1

1

As the system level, on Linux, you can use lsof. Example (replace TOMCAT_PID with the process Id of your Tomcat process)

lsof -p TOMCAT_PID

And if you know more specifically what you're looking for, just grep for it:

lsof -p TOMCAT_PID | grep /path/to/somewhere

EDIT: I've never used it, but on Windows I'd try something like this: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

于 2013-08-30T01:05:03.183 回答