If you want to directly respond to an interrupt from Java, then the virtual machine will have to run in kernel space (or on some systems with user space drivers in the driver context). JamaicaVM works in this mode on some RTOS, such as Thread-X or VxWorks, like DKM. The next release of RTSJ will support Java interrupt functions.
RTSJ can be used to run second-level interrupt handlers even in user space. This requires a small device driver that either sends a POSIX signal to the virtual machine, or provides a personal device interface where one thread in the blocks of the virtual machine is blocked while reading the device. In the first case, AsyncEventHandler may be associated with a POSIX signal. In the second case, protectors that block when the device is reading can start AsyncEvent every time a byte is read from the device. Any AsyncEventHandler attached to AsyncEvebt will then be released.
If you want to try this under Linux, you can download the personal version of JamaicaVM: "http://www.aicas.com/jamaica-pe.html". JamaicaVM has a real-time garbage collector, and the code can be statically compiled to provide real-time performance. This is a different deployment model than the regular JVM.
source share