How CICS deals with a queue of requests waiting for a JVM

When CICS has a queue of requests waiting for a JVM, it takes the actions summarized in Figure 1:
Figure 1. Dealing with a queue of requests waiting for a JVM
The text in the following paragraphs explains this figure.
  1. If any request that is waiting for a JVM to become free has been waiting longer than a critical period (which CICS determines), CICS gives it the next available JVM, whatever the profile and execution key of the JVM. This applies both to requests that have been placed on the queue because no JVMs are free, and requests that have been placed on the queue because the free JVMs have the wrong profile or execution key. There will be either a mismatch or a steal, and the JVM and possibly the TCB are likely to be re-initialized (unless the request is in a queue and the next free JVM happens to have the correct profile and execution key), but the action is worth taking, as the request should not wait any longer.
  2. If requests are queueing and a JVM becomes free, but no requests have been waiting longer than the critical period, CICS scans through the queue to find the longest-waiting request that requires a JVM with that profile and execution key. It gives the free JVM to the longest-waiting request that specifies the correct profile and execution key. So in this situation, the JVM does not need to be re-initialized, and a mismatch or steal is avoided.
  3. If CICS cannot find a request that matches the profile and execution key of the free JVM, it scans through the queue again and uses the selection mechanism to look for a request where it will be an advantage to destroy and re-initialize the free JVM, and re-initialize it as a JVM with the profile and execution key that the request needs. A mismatch or a steal occurs, but the selection mechanism ensures that it occurs for a deserving request.
  4. If CICS does not find a request in the queue where it will be an advantage to destroy and re-initialize the free JVM, the JVM is kept free to await a more appropriate use. For example, CICS might receive a request that needs a JVM with the profile and execution key of the free JVM; or the first request in the queue might wait longer than the critical period, and so be given the free JVM; or CICS might receive a request where it is an advantage to destroy and re-initialize the free JVM.