On 2 Jun 00, at 9:38, Rickard �berg wrote:

>
> > Question 4:  I see where you are ejecting the bean instance from
> > the container, in EntityInstanceInterceptor at least.  But when I
> > follow the calls, it just comes down to removing the instance from a
> > Map.  Any resources (such as open database connections) that
> > this instance has open will stay open until the bean is actually
> > garbage collected.  We should be able to free the resources
> > obtained from a factory in the bean's namespace.  We can't
> > depend on an EJB being parsimonious with their system
> > exceptions.
>
> Correct. Any good ideas on how to do this hookup between the container
> and the resource managers?
>

Hi Rickard,

Presumably, we will "own" all the resource factories from which
resource connections are retrieved (such as
org.jboss.jdbc.DataSourceImpl).  When a connection is retrieved
from one of these factories, it could add a reference to a map
associating the bean instance to a list of its open connections.

According to the JTA spec 3.4.2, a resource connection must
notify the application server when it is closed.  When the server is
notified that a resource has been closed, we could remove it from
this map.

When a bean is ejected from its container, we could find its open
connections in the map and close them.  Operations on a map
tend to be pretty fast, and the memory requirements are minimal
for any realistic number of resource connections.  I think the
overhead of this solution would be acceptable, and it should be
easy to implement.

Obviously, we can't close unmanaged resources in this way.  I'm
happy to let the garbage collector take care of those.  With the
recent release of the Connector spec, unmanaged resources
should go the way of the dinosaur.

-Dan


Reply via email to