Threads considerations for Java language

Java™ threads operate on top of the IBM® i kernel threads model using the java.lang.Thread class. Each Java thread is one of the many tasks that run in the process.

You can do all of the activities that are listed in the Threads Management section.

The Java virtual machine (JVM) always creates several threads to perform services such as Java garbage collection. The system uses these threads; applications should not use them.

You can use native methods to access system functions that are not available in Java. Native methods are not *PGM objects. They are procedures that are exported from Integrated Language Environment® (ILE) service programs (*SRVPGM). These native methods always run in multithreaded processes; therefore, they must be threadsafe. The ILE COBOL, RPG IV, CL, C, and C++ compilers are threadsafe.

Note: Not all standard C and C++ functions are threadsafe. Refer to the C and C++ topic in the information center.

When it is necessary to call an ILE program (*PGM) object, use java.lang.Runtime.exec() to start another process in which the program can run.

Use exit() and abort() with care. These functions end the application, including the process and all the threads that run in the process.