Ralph Goers wrote:
OK. That makes it tougher. So if two bundles want to register the same protocol I guess one of them loses?
Well, in the standard Java sense it is worse than that, since only one entity can set the stream handler factory. OSGi URL Handlers improves on this by allowing bundles to share the single stream handler factory. Regarding your specific question, yes, only one bundle at a time can provide a handler for a given protocol and the framework selects which one to use; however, other bundles are free to offer their handlers for the same protocol and the framework might use theirs if the current one goes away (i.e., the bundle providing it is stopped).
I don't understand why this is a problem. I was under the impression that OSGi would always be returning a proxy stream handler that is basically the same for every protocol. So it is the proxy that needs the list of handlers, not the JVM. Am I misunderstanding section 11.3.1?
You are correct, but I think that Niclas was describing standard Java behavior, not the OSGi URL Handlers spec behavior. OSGi URL Handlers takes the standard Java behavior one step further by sharing URL handling among bundles, we are talking about taking it even one step further by sharing URL handling among framework instances.
-> richard