I've been experiencing some problems in implementing a graceful shutdown in a server app I'm writing. The app keeps some HDFS files open at all times and needs to close them before completely shutting down. However, what keeps happening is that I get some "Filesystem closed" message.

I've tracked this down to the fact that Filesystem registers its own shutdown hook handler for the purpose of closing all filesystems. Apparently, this shutdown hook gets run prior to (or concurrently with) my server shutdown hook, and as a result, when I try to close my files I can't.

I've looked around, and I can't seem to find a Java Runtime method for controlling the order of shutdown hooks, and I don't think HDFS gives me any way to suppress this shutdown hook behavior. Does it make sense for this to be configurable? I'd be fine with the responsibility of having to close all the filesystems myself as long as I got control.

-Bryan

Reply via email to