Show TOC

Accessing the AS Java Thread ManagerLocate this document in the navigation structure

  • 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 an AS Java application thread using the SAPAdapterResource instance.
    Note

    Open SPIManagedConnectionFactory.java and search for the character string CS_THSTR.

  • An instance of SAPAdapterResource must have already been determined using JNDI.

    The object is located in the JNDI directory under the key SAPAdapterResources.

    Note

    Open SPIManagedConnectionFactory.java and search for the character string CS_THREADMGR.

  • 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 a sender adapter that is switched to active.

    You manage the thread status in a separate variable.

    Implement suitable start() and stop() methods.

  • The adapter must only start its own threads for sender channels.

    The messaging system creates the thread for receiver channels.

  • When the adapter is not active, ensure that it does not add any threads to the cache or to a separate thread pool.

    AS Java administers an application and system thread pool for this purpose.

    The maximum number of threads that each pool can contain is defined.

    This limit is defined using the parameter MaxThreadCount in the kernel services ApplicationThreadManager and ThreadManager.

    Ensure that the thread consumption of the adapter is well below this value. If necessary, advise your customers to set this value suitably high.

    More information: Thread System

  • In the case of receiver channels, the messaging system sets an additional upper limit for worker threads per adapter type.

    You can configure this limit in the service PI AF Core by using the parameter messaging.connectionDefinition.

    You can set the parameter value as follows, for example:

    name=myAdapter_http://myAdapterNamespace, messageListener=localejbs/AFWListener, exceptionListener=localejbs/AFWListener, pollInterval=60000, pollAttempts=60, Send.maxConsumers=7, Recv.maxConsumers=7, Call.maxConsumers=7, Rqst.maxConsumers=7)

    More information: Properties for Service XPI AF Core