JVM Callbacks for hardware state events

Strange but true, a Java program cannot detect the situation where it is still running but the laptop is going to sleep because the user closed the lid. Neither can a full-blown Java application server like GlassFish detect a power loss event reported by the UPS and safely inform its clients or sibling cluster nodes that it will be away soon.

This is ridiculous, as the operating system knows all these events very well and there are native APIs to inform applications about state changes for decades. I wonder why nobody every asked to such an API on the Java platform?

Anyways, if you share my impression that it would be beneficial for an application to detect such state changes, then please vote for my proposal on OpenJDK’s JIRA.

Advertisements

About Markus Karg

Java Guru with +30 years of experience in professional software development. I travelled the whole world of IT, starting from Sinclair's great ZX Spectrum 48K, Commodore's 4040, over S/370, PCs since legendary XT, CP/M, VM/ESA, DOS, Windows (remember 3.1?), OS/2 WARP, Linux to Android and iOS... and still coding is my passion, and Java is my favourite drug!
This entry was posted in Java, Open Source, Programming, Standards and tagged , . Bookmark the permalink.