Copyright © 2004, Aonix
45
Issues with the JNI Protocol
•Since it serves as “glue” between the JVM and the OS, JNI code manifests many JVM and OS implementation dependencies
–Green threads vs. RTOS threads
–Object copying at interface or not
–RTOS priorities, RTOS services, Synchronization, etc.
•JNI code may compromise JVM integrity
•Native methods live outside the OO paradigm:
–May fail to unlock locks, fail to propagate exceptions, etc.
•Performance of the interface is expensive, requiring a certain amount of marshalling
•C code runs sub-optimal because of object sharing protocols
•JVM threads run sub-optimal because of
coordination and synchronization protocols