I generated resource adapter by code generator (1.5 JCA spec, no transactions, no datasource, outbound) and I'm not able to call generated matchManagedConnections() and manually added ValidatingManagedConnectionFactory.getInvalidConnections() methods for checking valid connections?
Thank you in advance,
The JCA container calls matchManagedConnections() in order to verify if a ManagedConnection can be reused - see http://docs.jboss.org/ironjacamar/userguide/1.1/en-US/html/samples.html#sample_helloworld_mcf. In most cases you would use the Subject and/or CRI to verify a match.
The ValidatingManagedConnectionFactory interface can be implemented in order to help the JCA container to clean up unneeded managed connections.
I generated RA skeleton with code generator (like follows) and I would expect that everything was corretly generated:
marti-pc:codegenerator pjuza$ sh ./codegenerator.sh
Profile version (1.6/1.5/1.0) [1.6]: 1.5
Type (O/Outbound/I/Inbound/B/Bidirectional) [O]:
Package name: com.cleverlance.smartclient.ra.httpclient
Transaction support (N/NoTransaction/L/LocalTransaction/X/XATransaction) [N]:
Support reauthentication (Y/Yes/N/No) [N]:
Include a ResourceAdapter (Y/Yes/N/No) [Y]:
Resource adapter class name [AcmeResourceAdapter]: HttpClientResourceAdapterImpl
Resource adapter config properties [enter to quit]:
Managed connection factory class name [AcmeManagedConnectionFactory]: HttpClientResourceAdapterImpl
Managed connection factory config properties [enter to quit]:
Use ResourceAdapterAssociation (Y/Yes/N/No) [Y]:
Managed connection class name [AcmeManagedConnection]: HttpClientManagedConnectionImpl
Use CCI (Y/Yes/N/No) [N]:
Connection factory interface class name [AcmeConnectionFactory]: HttpClientRaConnectionFactory
Connection factory implementation class name [AcmeConnectionFactoryImpl]: HttpClientRaConnectionFactoryImpl
Connection interface class name [AcmeConnection]: ManagedClientConnection
Connection implementation class name [AcmeConnectionImpl]: ManagedClientConnectionImpl
Add methods to connection interface (Y/Yes/N/No) [N]:
Additional managed connection factory (Y/Yes/N/No) [N]:
Include an admin object (Y/Yes/N/No) [N]:
Generate a MBean class (Y/Yes/N/No) [Y]:
Build environment [A/Ant/I/Ant+Ivy/M/Maven] [A]: M
I have been trying to change settings in ironjacamar.xml but without positive results. I doubt if matching connection is possible for non-datasource connections? And if it's true then it is specific for ironjacamar only or is it general JCA contract?
I will reply to myself - I read JCA specification and I found:
"Connection Matching Contract
The application server invokes the ManagedConnectionFactory.matchManagedConnections method (implemented by a resource adapter) to find a matching ManagedConnection for servicing a connection request. The application server passes a candidate set of ManagedConnection instances to the matchManagedConnections method.
The application server should use the connection matching contract for ManagedConnection instances that have no existing connection handles. A candidate set passed to the matchManagedConnections method should not have any ManagedConnection instances with existing connection handles."
Now ManagedConnectionFactory.matchManagedConnections is called.