Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JCA-Resource Adapter: ManagedConnection holds several connections?

 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to write a Resource Adapter (Connector), and would appreciate hints on the relation between ManagedConnection and the underlying "Connection handle" (namely, the one returned by ManagedConnection.getConnection()).

Addison Wesley's "J2EE Connector Architecture" says:

It is possible to have multiple connection handles associated with the same ManagedConnection. An application server might call getConnection multiple times to enable sharing of a ManagedConnection across multiple
connection handles.
As a result, it is important that no states are kept in the connection handles. They should be treated as a stateless pipe, or pointer, to the ManagedConnection


Does that mean the same ManagedConnection should store multiple Connection "handles" at the *same time* ? Something like:


If so, what's the motivation? I mean, I understand the container (and its ConnectionManager) use ManagedConnections to handle pooling, transactions, and getting ConnectionEvents.
But for this, isn't it enought for each ManagedConnection to hold a single connection handle ?
(I realize container's behaviour is vendor-specific, but I'm looking for some reasonable scenario, or example, where it would make some sense).

Thanks
 
sam sepassi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it mostly uses a data structure such as SET to hold the connection handles. The connection handles are added and removed from the set all time.

If you review the specification the managed connection class implements the clear() method that is used to clear connection specific information (connection set).

P.S. J2EE samples from Oracle contains a sample resource adapter implementation which is very helpful indeed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic