IBM WebSphere Adapters User Manual page 107

Version 6 release 2
Table of Contents

Advertisement

Best practices
v Each ManagedConnection instance should encapsulate at most one connection to
the EIS.
v Since there may be more than one Connection instance for each
ManagedConnection instance, resource adapter developers should implement
private contracts between their WBIManagedConnection subclass and their
WBIConnection/WBIInteractionsubclasses to ensure that access to the
underlying EIS connection or API is performed in a thread-safe manner.
If the EIS API does not support concurrent access by multiple connection
handles, concurrent access should not be denied. Instead, the implementation
should ensure that one and only one handle can access the EIS at a time
(through synchronization blocks, wait/notify patterns, and so on).
v At the start of any EIS-specific method implementation, developers should
always invoke super.checkValidity(); this method checks the state of the
ManagedConnection instance to ensure that it has not been closed, encountered
an error, and so on.
v If possible, always employ eager class initialization of the physical connection to
the EIS; do not assume that getConnection is the first method invoked. The JCA
container may need to access the XAResource, LocalTransaction or other features
of the managed connection for recovery, and so on, before any client even issues
a first request.
WBIConnectionFactory:
WBIConnectionFactory implements the ConnectionFactory interface. Subclasses
should implement the constructor only. As javax.resource.cci.ConnectionFactory,
this interface enables clients to request connections to an EIS.
Subclass methods to implement
public TwineBallConnectionFactory(ConnectionManager connMgr,
{
super(connMgr, mcf);
}
WBIConnection:
WBIConnection implements the Connection interface. An instance of this interface,
such as javax.resource.cci.Connection, represents a client connection handle to the
underlying EIS connection. A client obtains this connection by calling the
getConnection method of the ConnectionFactory instance.
Subclass methods to implement
1. Implement the constructor that takes a ManagedConnection and call the Super
class constructor that associates this connection handle with the
ManagedConnection.
public TwineBallConnection(WBIManagedConnection managedConnection)
{
super(managedConnection);
}
2. Create an EIS-specific interaction instance that enables clients to invoke
functions on the underlying EIS.
WBIManagedConnectionFactory mcf)
throws ResourceException
WebSphere Adapter development overview
101

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Websphere adapter toolkit

Table of Contents