Managing the Lifecycle of a JCA
Adapter
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 objects are instantiated or released.
Since an adapter usually reserves external resources automatically (for example, inbound connection, threads, to process sender/inbound messages), it must also know when to rerelease these resources and complete sender/inbound 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.
If the Adapter Framework is based on JCA 1.0, you must note the following implementation considerations if your adapter supports the sender/inbound direction:
● You must implement the interface com.sap.engine.interfaces.connector.ManagedConnectionFactoryActivation (MCFA) in MCF. This is an SAP J2EE-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().

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/inbound processing at some stage. This is usually done at the end of the ManagedConnectionFactory constructor (MCF). Before sender/inbound 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.

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