First a little background

ServiceTracker has two open methods:

public void open(boolean trackAllServices) and public void open() (which calls open(false))

The javadocs for trackAllServices is:

     * @param trackAllServices If {@code true}, then this
     *        {@code ServiceTracker} will track all matching services
     *        regardless of class loader accessibility. If {@code false},
     *        then this {@code ServiceTracker} will only track matching
* services which are class loader accessible to the bundle whose
     *        {@code BundleContext} is used by this
     *        {@code ServiceTracker}.


2.  ECF's Remote Services Admin proxy creation

In the Enterprise Remote Service Admin spec (chap 122) in section 122.5.6 (Proxying) it describes an approach for using a ServiceFactory to create a proxy, and using the classloader of the invoking bundle to load interface classes for creating the proxy. I believe this is for security...it ensures that the service interface classes are accessible to the bundle accessing/creating the proxy.

We/ECF fully implement this approach...i.e. using a ServiceFactory and using the classloader of the invoking bundle to load proxy interface classes. It generally works fine.

BUT, it seems that by using this approach, the ServiceTracker.open(false) does not allow proxies to be discovered by ServiceTrackers that have been opened via open()/open(false). Rather, it's necessary to use ServiceTracker.open(true)...and this allows the proxy to be discovered by the service tracker.

Is this expected? That is...the scheme for proxying described in 122.5.6 (that we implement) seems to require that clients using ServiceTracker use open(true) rather than open(false) in order to discover the created proxy. Using open(true) is doable, of course, but is inconvenient for some consumers that are used to using open().

Thanks,

Scott





_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to