Pool threads

Pool threads are defined with the THREADLIMIT(n) DB2CONN parameter.

There are four situations where a pool thread can be used:
  1. A transaction is not specified in any DB2ENTRY or DB2TRAN, but issues SQL requests. This transaction defaults to the pool and uses the plan specified for the pool.
  2. A transaction is specified in a DB2ENTRY or DB2TRAN referencing a DB2ENTRY, but is forced to the pool because the DB2ENTRY specifies THREADLIMIT(0) and THREADWAIT(POOL). This transaction uses the plan specified in the DB2ENTRY.
  3. A transaction is specified in a DB2ENTRY or DB2TRAN referencing a DB2ENTRY, but overflows to the pool (THREADWAIT=POOL) when the THREADLIMIT value is exceeded. This transaction uses the plan specified in the DB2ENTRY.
  4. A transaction is specified in a DB2ENTRY or a DB2TRAN referencing a DB2ENTRY, but the DB2ENTRY is disabled. The DISABLEDACT keyword is set to POOL, therefore a pool thread is used. This transaction uses the plan specified for the pool.

Pool threads are always unprotected threads.

Pool threads are created, used, and terminated as follows:
TCB attach
No thread TCBs are attached when the CICS DB2 attachment facility is started.

A TCB is attached only if needed by a thread.

Thread creation
A thread is created only when needed by a transaction.
Thread termination
The thread is terminated immediately after it is released, unless it has a transaction queued for it.
Thread reuse
Other transactions using the same plan can reuse a thread when it becomes available. In the pool this happens only if there is a queue for threads and the first transaction in the queue requests the same plan used by the thread being released.