Start of change

Threads and sockets in Java applications for CICS

For a Java application running in a JVM in a CICS region, threads and sockets should be used with caution. These Java features could affect the isolation of CICS tasks, and interfere with JVM phaseout.

The main thread under which a JVM starts is called the Initial Process Thread (IPT). Application code that uses the JCICS API must execute under the IPT. CICS ensures that the public static main method in any Java program (from the Java class specified by the JVMCLASS attribute in the PROGRAM resource definition) executes under the IPT, and this is also the case for enterprise beans and stateless CORBA applications.

It is possible for application code running in a JVM to start a new thread, or call a library which starts a thread on its behalf. Threads started by user code cannot make use of CICS services; if you attempt to do this, the JVM abends with an 0501 user abend code. An application could start a thread and use it for purposes other than interacting with CICS. However, the use of threads in a Java application for CICS can have undesirable consequences, depending on the type of JVM.

Threads started by application code might be used to manage sockets created using classes in the java.net package. Sockets created using the java.net classes use the JVM's native sockets capabilities, rather than the CICS sockets domain. These sockets are not managed by CICS, and the user is responsible for handling and managing them. CICS is not capable of transactionally managing or monitoring any communications performed using these sockets.

You could consider using the Java 2 security policy mechanism to prevent applications from starting threads or from creating sockets using the java.net classes. A security manager can be used for both resettable and continuous JVMs. Note that the CICS-supplied enterprise beans policy file, dfjejbpl.policy, does allow the use of sockets, because this is recommended in the Enterprise JavaBeans specification. You should only consider removing this permission if you do not use enterprise beans.

End of change