Java virtual processors

Java™ UDRs execute on specialized virtual processors called Java virtual processors (JVPs). A Java Virtual Machine (JVM) is embedded in the code of each JVP.

The JVPs are responsible for executing all server-based Java UDRs and applications. Although the JVPs are used for Java-related computation, they have the same capabilities as a CPU VP, and they can process all types of SQL queries. This eliminates the need to ship Java-related queries back and forth between CPU VPs and JVPs.

Thread scheduling

When the JVP starts the JVM, the entire database server component is thought of as running on one particular Java thread, called the main thread. The JVM controls the scheduling of Java threads and the database server scheduler multiplexes HCL OneDB™ threads on top of the Java main thread. In other words, the HCL OneDB thread package is stacked on top of the Java thread package.

Query parallelization

While Java applications use threads for parallelism, the HCL OneDB database server uses threads for overlapping latency. That is, HCL OneDB threads run concurrently but not in parallel. To parallelize a query, the database server must spread the work among multiple virtual processors.

Consequently, the database server must have multiple instances of JVPs to make parallel calls to UDRs written in Java code. Because the JVMs embedded in different VPs do not share states, you cannot store global states by using Java class variables. All global states must be stored in the database to be consistent. The only guarantee from the database server is that any given UDR instance executes from start to finish on the same VP. The database server enforces a round-robin scheduling policy where the UDR instances are spread over the JVPs before they start executing.

The consistency of multiple JVMs is not an issue on the Windows™ platform because all VPs are mapped to kernel threads instead of processes. Because all VPs share the same process space, you do not need to start multiple instances of the JVM.