jenkinsci / lib-file-leak-detector

Java agent that detects file handle leak
http://file-leak-detector.kohsuke.org/
MIT License
241 stars 112 forks source link

Add close flag to configuration #5

Closed jesperpedersen closed 11 years ago

jesperpedersen commented 11 years ago

This allows the application to control when the listeners are flush/closed.

Needed because the installed shutdown hook maybe run first before files are closed during shutdown.

buildhive commented 11 years ago

Kohsuke Kawaguchi » file-leak-detector #4 SUCCESS This pull request looks good (what's this?)

kohsuke commented 11 years ago

I think the right thing to do here is for the caller of Listener.TRACE and Listener.ERROR to dilligently flush the stream after dumping the message there, to make sure the message gets delivered. Some of the code already does that, and we just need to be bit more thorough here.

The shutdown hook to close those streams doesn't make much sense to me, as when the JVM exits those streams are closed, and as you point out, there's no guarantee about the order this shutdown hook runs among other shutdown hooks.

I'm adjusting the code accordingly.