Tuesday, March 5, 2013

Why, Java, Why?

So I have a Java application that runs under Windows, but doesn't have its own window or UI. It runs in the background.

My application starts up a copy of a MySQL database. The application needs to shut down the database reliably when the application itself shuts down. A nice, controlled shutdown will prevent data corruption.

There's no way for my app to react to an operating system shutdown.

I'm supposed to be able to use Runtime shutdown hooks to react to a shutdown of the JVM. This doesn't seem to work. I'm not the only person who's noticed this.

I can't react to window closing events because I don't have a window. The app doesn't have a UI.

I'm baffled that a programming language with the stature, age, and usage of Java would behave in this fashion.