JCA1.5 study notes

xiaoxiao2021-03-06  74

JCA1.5 study notes

Zhang Xiaoot

1 Scope:

JCA 1.0 defines a set of standard protocols for system-level between application servers and EIS (enterprise information systems), which focuses on integrated system-level important aspects: Connection Management, Transaction Management (Transaction Management) ), Security management. And define the CCI (Common Client Interface) universal client interface with multiple enterprise information systems interacts, as well as a standard distribution and packaging protocol for resource adapters.

JCA1.5 defines the following agreement:

2 Lifecycle Management Protocol: This is an agreement between application servers and resource adapters that allow the application server to manage the life cycle of the resource adapter. This protocol provides a mechanism for the application server to start a resource adapter instance when the resource adapter is configured or the application server, and notifies the resource adapter instance when the resource adapter is uninstalled or the application server is turned off.

2 Work Management Protocol: This is an agreement between the application server and the resource adapter, which allows the resource adapter to do some work by submitting a work instance (like monitoring network port, calling application components, etc. ). The application server then performs submitted work instances through the assignment thread, which avoids the resource adapter to create or manage threads directly to perform some tasks, and make the application server to implement more more and more efficient controls on the running pool at runtime environment. management. And the resource adapter can control the security context environment and transaction context environments for the executed work example.

2 Transaction Inflow Contract: This protocol is an agreement between application servers and resource adapters that allow resource adapters to pass an input transaction to the application server. This protocol also allows the resource adapter to pass the transaction completion and fault recovery calls initialized by the enterprise information system, and ensure the ACID (Atomicity Atomic, Constensency, ISOLATION Isolation and Durability Persistence) attributes being reserved. .

2 Message Inflow Contract: This is a standard, universal protocol between the application server and the resource adapter, which allows the resource adapter to be used by the specific message format, message semantic, message structure that is used independently of the send message. Asynchronous send messages are in place in the message port in the application server. This protocol also allows for a broader message provider (like Java Message Service, Java API for XML Messaging, etc.) into the J2EE compatible application server through the resource adapter in plug-ins.

2 For non-type (Outbound Only Output, Inbound Only Enter, OR Both Enter Output) Resource Adapter Description The corresponding packaged mode.

2, life cycle management

2 Application Server implements javax.resource.spi.bootstrapContext and Javax.Resource.spi.WorkManager interface. The resource adapter implements a javax.resource.spi.resourceAdapter interface. The class that implements the ResourceAdapter interface is specified in the configuration description file of the resource adapter, and this implementation class must be a JavaBean.

When a resource adapter is configured or the application server is started, the application server launches an instance of a resource adapter in its own address space. To start a resource adapter instance, the application server must use the configured resourceAdapter interface implementation class, and call its Start method, this start method call is a startup notification from the application server, and this start method is the thread call of the application server. of. An application server allows multiple resource adapter instances to be simultaneously present in the same JVM, but these instances are not necessarily equal, determining if these instances are equal, can pass the equals method of the instance, so the implementation class of the ResourceAdapter interface needs to implement the equals method.

In the Start method call, the resource adapter instance initializes yourself and may use WorkManager to submit a Work instance to execute. This START method call should return in time and should avoid blocking calls. If the DOWORK method called the Workmanager instance is blocking call. If the WorkManager instance is called or any blocking method, the application server may throw a WorkrejectedException exception. In order to force the START method to not be blocked, it is highly recommended that the resource adapter implements the use of WorkManager's Startwork and ScheduleWork methods. DOWORK method.

Throw any exception when calling the START method, will cause the application server to create a resource adapter instance failed, and may increase the two-phase startup process in the future version of the JCA.

ResourceAdapter JavaBean represents a resource adapter instance and includes configuration information of the corresponding resource adapter instance, which may also be used as a global default configuration information for ManageDConnectionFactory or ActivationSpec JavaBean.

A resource adapter instance may provide two-way links for multiple enterprise information system instances. A ManageDConnectionFactory Javabean can be used to provide an output connection to a single enterprise information system. An ActivationSpec JavaBean can be used to provide an input connection from an enterprise information system; a resource adapter instance may include several ManagedConnectionFactory and ActivationSpec JavaBean.

2 A ManagedConnectionFactory JavaBean indicates an output link from the application to the enterprise information system instance through the resource adapter. At the same time, it also includes the corresponding output connection configuration information, which is the configuration information of the resourceAdapter JavaBean, that is, the configuration information of the output connection is the integrated information of the resourceadapter javabean and the ManagedConnectionFactory Javabean, and the configuration information of ManagedConnectionFactory may Override the configuration information of the ResourceAdapter (when there is a configuration information of the same name).

² output connection is initiated by the application server, and you must create an association between a JavaBean and ManagedConnectionFactory ResourceAdapter JavaBean, the association is through setResourceAdapter interface method calls RsourceAdapterAssociation to do, and specify the interface between ResourceAdapterAssociation ManagedConnectionFactory and ResourceAdapter JavaBean JavaBean Association relationship. SetResourceAdapter to be called at least once, that is, this association can also be changed.

2 An Activationspec JavaBean indicates the input connection from the enterprise information system to the application server via the resource adapter instance, which also contains the configuration information of the input connection, which is also integrated with ResourceAdapter JavaBean and ActivationSpec JavaBean. The input connection is initiated by the enterprise information system. ActivationSpec JavaBean must also be associated with ResouceAdapter JavaBean, as it is an output connection or input connection is connected via ResourceAdapter This intermediate bridge is established. It is also the purpose of the association through the SetResourceAdatper method. 2 Resource Adapter Instance Closing Need two phases: The first phase application server stops all application components that use this resource adapter instance until all application threads are not using this resource adapter instance. The second stage is to call the STOP method of the ResourceAdapter JavaBean to notify the resource adapter instance to stop the service.

3, connection management

A) Application Components Find connecting Factory ConnectionFactory via JNDI

B) ConnectionFactory passed the request for the connection to the ConnectionManager instance.

C) After receiving the connection factory's request, the ConnectionManager receives the connection pool supplied by the application server. If there is a connection to the required connection, the matching managedConnection instance will match the connection request, then return to the connected factory, then connect the factory to return To the application component, if there is no connection to the required connection in the pool, the application server uses the implementation class of the ManageDconnectionFactory interface (implemented in the resource adapter) to create a new physical connection to the enterprise information system, the application server will create this new creation The ManageDConnection instance is placed in the connection pool and register a ConnectionEventListener implementation to the ManageDConnection instance, which allows the application server to get notifications for the ManageDConnection instance status. Then return to the application component.

4, transaction management

5, safety framework

6,

Last continued

转载请注明原文地址:https://www.9cbs.com/read-107406.html

New Post(0)