-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Describe the bug
Currently ProxyBundleProvider doesn't allow more than one services to use a specific proxy bundle version, currently this represents a major restriction placed on the use of OSGi services.
The reason this occurs is a mismatch between OSGi bundle loading and service proxy identity.
There is a many to one relationship between proxy identity and bundles. OSGi doesn't allow loading duplicate bundles.
Options and thoughts on how to handle this, all suggestions are welcome:
- Allow different services to share the same classes, consequences; loss of service proxy identity, unwanted permissions granted to less trusted services.
- Encapsulate the service proxy with another proxy, unfortunately this wont work with RemoteMethodControl, which would return a new instance.
- Create a shim InvocationHandler, who's class is loaded directly by BundleDelegatingClassLoader, so that whenever remote method calls are made, the permissions granted are granted to this particular ClassLoader and ProtectionDomain. Then only one bundle would need to be loaded, but the presence of the InvocationHandler on the call stack would reduce permission to the intersection of the sets of permissions on the call stack. We would need to make BundleDelegatingClassLoader override preferred ClassLoader and prefer the class of the InvocationHandler. It would be best if the InvocationHander is in its own package, in the JERI bundle. During marshalling this InvocationHandler would need to replace itself with the encapsulated InvocationHandler, however that may create problems with equality, with the CodebaseAccessor InvocationHandler. Since we know the InvocationHandler will be an instance of AtoimcInvocationHandler, we can extend it instead, with a stateless child class that only has an @AtomicSerial constructor and replaces itself with the superclass when serialized. This class wouldn't be exported from the package, and CodeSource could be used to find the URL of the bundle.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels