Processing multiple concurrent interactions

The system-wide Connector Framework can create separate threads for processing an application event and a business object request. When processing multiple requests from the integration broker, it can create multiple threads to handle multiple business object requests. For example, when InterChange System is the integration broker, the connector can receive multiple business object requests from multiple collaborations or from a multi-threaded collaboration.

Important:
BAPI business object handlers generated before the connector for SAP version 4.3.0 are not thread-safe. To guarantee data consistency and integrity when using multi-threading, you must regenerate these business object handlers. The business objects do no require any change.

Figure 3 illustrates the multi-threading architecture.

Figure 3. Multi-Threading Architecture of the Connector for SAP

Event processing

The connector performs the following steps when handling a poll call:

  1. The system-wide Connector Framework creates a single dedicated thread to handle poll calls. This thread calls the pollForEvents() method of the vision connector framework at the frequency specified in the PollFrequency configuration property.
  2. The thread polls SAP, which uses a dialog process to locate and return the event.
    Note:
    If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates a connection to SAP for polling. If MaxNumberOfConnections evaluates to 1, event and service-call request processing share a single connection to SAP.

The polling thread dies only when the connector shuts down.

Note:
Because the RFC Server connector agent pushes events out of SAP instead of polling for events, it spawns its own threads instead of using threads created by the connector framework. Because the ALE connector agent uses the RFC Server connector agent to access events, it also it spawns its own threads instead of using threads created by the connector framework when it processes events.

Request processing

Independently of polling, the system-wide Connector Framework can create multiple request-processing threads, one for each request business object. Each request thread instantiates the appropriate business object handler.

For example, when processing business object requests from InterChange Server, the number and type of business object handlers depends on the number and type of the collaborations sending the requests:

If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates one connection to SAP for polling and allocates the remaining connections to a pool used only for request processing.

As illustrated in Figure 3, the connector performs the following steps when handling a business object request:

  1. The system-wide Connector Framework creates a separate thread for each business object request. Each thread calls the doVerbFor() method of the Vision business object handler.
  2. If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the Vision business object handler checks the vision connector framework's connection pool to determine if a connection handle is available.

    If the connector's MaxNumberOfConnections configuration property evaluates to 1, the Vision business object handler shares a connection with event processing.

  3. SAP releases the dialog process after it completes processing and sends a return code.
  4. The connector releases the connection handle after it receives the return code from SAP.

Setting the number of available connections

Use the MaxNumberOfConnections configuration property to specify the maximum number of connection handles available. The number of connections cannot exceed the number of dialog processes.

SAP locks the dialog process while processing an interaction, releasing it only when the interaction completes. Therefore, multiple concurrent requests lock an equal number of dialog processes until processing finishes.

Important:
Before setting a value for MaxNumberOfConnections, contact your SAP BASIS administrator to determine an appropriate value to maximize throughput without negatively affecting performance on the application server.

Setting multiple connections

By default the connector supports only single-threading. To cause the connector to support multiple threads, remove the following flag from your connector startup script:

-tMAIN_SINGLE_THREADED
 
-tSINGLE_THREADED
 

For more information, see the Connector Development Guide for Java.

Copyright IBM Corp. 1997, 2003