On Wed, May 27, 2015 at 9:09 PM, Brett Meyer <brme...@redhat.com> wrote:
> > Is that the best way to know when TransactionManagers and DataSources > come > > and go too? Or is there a more specific concept for listening to an > "OSGi > > service"? > > At least for TransactionManagers, yes, the BundleListener is probably the > best approach. I'm not aware of a more specific way beyond that, but I'm > not 100%. Honestly not sure about the DataSource -- can't remember if most > containers automatically expose that or not. > But I would have to know the bundle that TransactionManager comes from in order to listener to it, no? I think we ultimately want an "OSGi DataSource adpater" as well, sort of like we do with OsgiJtaPlatform. I say an adapter here so that it can fit with both ConnectionProvider and with MultiTenantConnectionProvider. > > > > Also, do the containers generally handle "in-flight" requests in > > regards to TransactionManagers > > and DataSources on activated/deactivated? I guess this is more a > > curiosity, since I do not see what we could do if the container does not > > manage it. > > Really good question, but not sure. The hope is that a truly > OSGi-friendly bundle is "dynamic" enough to gracefully terminate > in-progress actions if deactivated. They're given that opportunity through > BundleActivator#stop. Of course, that's entirely up to the specific impl. > I would expect Karaf container-provided defaults (Geronimo JTA, etc.) to > handle that reasonably well for basic cases, but not sure about the > real-world edge cases... > > Note that I always hoped to make Hibernate fit that bill, but we're *far* > from it. Deactivation would, in all likelihood, be catastrophic. And no > idea about re-activation. > I *think* de-activation would be catastrophic during the period that the depended-on bundle is not available. I am ok with that. That seems natural to me. If a bundle we are providing persistence for says it wants to use a JTA TransactionManager e.g. and that TransactionManager is not available... I think an exception is perfectly valid outcome. But yes it is the re-activation case (the TransactionManager becomes available again) that I want to work. In theory this should be a simple thing to do; I think we already have the proper encapsulation with OsgiJtaPlatform. I just have no idea how to know when these things become available and when they become unavailable. I'll poke around on the Kara user list and see what I can find. _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev