I like the idea to at least warn the user. Maybe this could be a flag on the command, i.e. auto-refresh the needed bundles. If this flag is not set up, we would print a warning in the console instead.
Another thing I was thinking about and started to implement at some point, is to have a batched feature installation, which would solve part of the problem, at least for initial provisioning. The idea would be to defer the start of the bundles at the end, i.e. when all bundles have been installed. This would allow wiring all optional imports in a set of features. This could also be done when installing a feature that has dependency on other features. This would thus reduce the number of refresh that need to be done afterwards, and I think this solution can be done in addition to the above. For our bundles, another way for optional imports is to back them with dynamic imports, so that the wiring is done early if possible and lately if not. I haven't actually tried that, but had a chat with Richard Hall that this should not really be a problem. The only downside is that it takes a bit more time before throwing a ClassNotFoundException when loading a class from an unsolved optional import package. But that would only work for servicemix bundles. On Fri, Oct 9, 2009 at 00:36, Chris Custine <ccust...@apache.org> wrote: > Hi All, > I have been looking at several issues this week that all relate to the > problem of refreshing bundles with optional imports. Guillaume has a couple > of issues opened related to this in Karaf: > https://issues.apache.org/jira/browse/FELIX-1074 > https://issues.apache.org/jira/browse/FELIX-1689 > > The real problem seems to be that users expect to be able to install and > start bundles without much manual intervention. But with the optional > imports case, there has to be a refresh on the bundle to pick up the newly > installed package. So generally speaking, these issues are being reported > as bugs when they are actually normal behavior. > > So the question is, how do we solve this in a nice user friendly way? Right > now, I am leaning toward Guillaume's suggestion to look through bundles with > optional imports on newly installed packages and refresh them very > selectively. However, I can imagine that some people would not like this to > be a default behavior and want more control over their deployments. It also > seems like refreshing things like Spring AOP can cause a lot of thrashing as > there are a lot of downstream bundles that will also refresh > (Spring-DM->Spring-Core->JBI components). > > So I think we need to determine what approach to take and document it so > that we are prepared when people run into these issues. Seems like our > options are to report more detailed logs or display a warning on the console > for the admin to manually refresh, or we try to do it in an automated > fashion when features/bundles are installed. > > BTW, I know this is a Karaf issue now, but it seems to happen to us a lot in > SMX so I wanted to start a discussion here for anyone not following Karaf > mailing list. > > WDYT? > > Chris > -- > Chris Custine > FUSESource :: http://fusesource.com > My Blog :: http://blog.organicelement.com > Apache ServiceMix :: http://servicemix.apache.org > Apache Directory Server :: http://directory.apache.org > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com