Show TOC

Managing the Lifecycle of a JCA AdapterLocate this document in the navigation structure

Use

JCA 1.0 does not provide any mechanisms for informing an adapter of a restart, an UNDEPLOY, or a REDEPLOY. Furthermore, JCA 1.0 does not specify whether ManagedConnectionFactory (MCF) objects are instantiated or released.

Since an adapter usually reserves external resources automatically (for example, inbound connection, threads, to process sender messages), it must also know when to release these resources and complete sender processing.

Using the finalize() method is not sufficient because it is not called until minutes or even hours later when the Java virtual machine garbage collector is running.

Activities

If the Adapter Framework is based on JCA 1.0, you must note the following implementation considerations if your adapter supports the sender direction:

  • You must implement the interface com.sap.engine.interfaces.connector.ManagedConnectionFactoryActivation (MCFA) in MCF. This is an SAP-specific interface. MCFA replaces the activation function in the Java Connector Architecture 1.5. The interface contains a start() method and a stop() method, which must be implemented by the MCF. The MCF must start the inbound processing and the allocation of the shared resources with start() and end inbound processing with stop() and release the shared resources.

    The example adapter contains the implementation of start() and stop().

    Note

    Open the example adapter and search for the character string SPIManagedConnectionFactory.java:CS_MCFASTART and SPIManagedConnectionFactory.java: CS_MCFASTOP.

  • You must start a new thread in the adapter for sender processing at some stage. This is usually done at the end of the ManagedConnectionFactory constructor (MCF). Before sender processing begins, you must check whether the MCF properties have already been set by the JCA container. You can set the adapter type and the namespace as JCA properties, since they must be known before the search for the configuration.

    This step is displayed in the example adapter.

    Note

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