On Nov 25, 2007 6:24 PM, Abdelgadir Ibrahim
<[EMAIL PROTECTED]> wrote:
>
> > The OSGi framework does not use a classloader that is a subclass of
> > URLClassLoader. So serialized object instances will be sent over the
> > wire to device D2 *without* a URL annotation, that would be used by
> > RMI running on device D2 to download and load classes dynamically.
> > So you will get a RemoteException when doing the remote call, whose
> > underlying cause will be a ClassNotFoundException.
>
> I am working on an RMI alternative solution that should enable me to 
> dynamically
> download all required classes from bundles in the source device D1. As I
> gather, Newton dynamically generates remote codebase annotations (using
> bytecode manipulation?!) when serializing classes to D2 so that the RMI system
> can utilise this additional information to download the required classes from
> D1.
>
> The essence of my approach is that for each remote service, device D2 is 
> passed
> a special handler object that knows how to download the required classes from
> D1. Device D2 then simply use this handler to dynamically obtain the required
> missing classes. The handler can do all sort of intelligent things and
> optimisations, for example, downloading multiple classes at a time, 
> downloading
> and buffering classes before they are actually required by D2, compressing the
> stream to improve performance etc. All these features are customisable meaning
> that a handler can still behave similar to RMI in terms of just in time 
> dynamic
> class loading. Provided that the performance of this solution is comparable or
> better than RMI, I believe it can be considered more powerful than RMI because
> of the added features and flexibility.
>
> Assuming for now that this solution works, should the handler obtain required
> classes from bundle B1 only or from both B1 and B2 ? In a previous post
> describing Newton, David Savage talks about "Dynamic installation of bundles
> based on unmarshal events" which is exactly my questions. In other words,
> dynamic installation of bundles means that classes from B2 will not be
> downloaded and instead B2 will be dynamically installed in D2.
>
> I will keep you posted about my progress and hope to provide you with much
> detailed description soon.
>
>
> regards

Sound nice - that's similar to what I did in SmartFrog, where I had a
description of the running distributed system that I could use to
infer what to download. Or maybe you're ok with having such a handler
for each service you want to call, so you can list all required
bundles to download and install in your handler. This however would be
quite brittle, as every implementation change in a service (a bundle
refactored into several ones, a new library used ...) would require
you to update the handler.

However, if you don't have some kind of system description at hand and
want to do sometinhg generic, you will likely run into this :
- D2 calls service S1, running on D1.
- D1, with code from bundle B1, processes the call and returns an
instance of class com.foo.Foo.
- Suppose now that B1 has such a declaration : import com.foo
- RMI running on D2 gets the results of the call
- RMI sees a class com.foo.Foo that needs to be loaded
- It asks your handler for the class
- Your handler needs to be aware of all package wirings on D1 to be
able to download and install the bundle com.foo.Foo comes from.

I think that's pretty much why they reimplemented RMI from scratch in
Newton, to make it fully aware of OSGi and capable of dealing with
such cases.

Keep us posted !
Cheers
-- 
Olivier Pernet

We are the knights who say
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to