Accessing the J2EE Thread Manager
● The Java class of your adapter, which should run in its own thread, must implement the standard interface java.lang.Runnable.
● The thread can be started as a J2EE application thread using the SAPAdapterResourceinstance.
mRes was determined previously, see the example under Accessing the J2EE Transaction Manager.

Open SPIManagedConnectionFactory.java and search for the character string CS_THSTR.
● The adapter itself must implement the thread lifetime management and must start and stop the thread at the correct time.
For example, the thread must be started in an activated sender/inbound adapter.
The adapter manages the thread status in its own variable and appropriate start() and stop() methods must be implemented.
● Many adapters must start their own worker threads, particularly for processing in the sender/outbound direction.
According to the general J2EE container rules, use J2EE-administered threads instead of system-specific JVM threads. The Adapter Framework API provides the SAPAdapterResources.startRunnable() method for this purpose. For more information about this topic, see the Javadoc.
○ Regardless of which thread type you are using, use a unique thread name for the adapter.
In the event of serious J2EE server problems, JVM thread dumps are often the only way to find the cause of the error. These dumps list all threads with their respective names. Unique thread names make it easier to search for adapter worker threads.
○ As soon as the thread is released, reset the thread name to the original value.
Another option is to give all application threads this adapter thread name after a certain time.
For more information about generating thread dumps, see SAP Note 710154.

Open SPIManagedConnectionFactory.java and search for the character strings CS_MCFTNAMESET and CS_MCFTNAMERESET.