Did a little research into RMI and IxC at work today. Don't really get a chance to explore new stuff there, but this important for our upcoming projects. RMI is "Remote Method Invocation", a system to run code in a "remote" Java Virtual Machine (JVM). Depending on the environment, the word "remote" can mean different things. It could represent a distant machine on the Internet or an app running in a logically separate sandbox (or context). IxC is "InterXlet Communication", and is part of some of the mobile Java profiles (J2ME, PBP, CLDC and lots of other acronyms). You can look at JSR-217, which is Personal Basis Profile (PBP) 1.1, looking for the package javax.microedition.xlet.ixc. What I've discovered so far is that IxC removes the generic portion of RMI by eliminating the registry and replacing with the IxcRegistry. Not really very much, but we spent a bunch of time trying to work out if it was possible to replace RMI registry with something of our own devising. So far, we have to say "no" if the objects to be exported were written to use IxC.
Before you get all huffy and add comments to illuminate my idiocy, the code in question has two parts - simple calls and callback registration. The first part can be done without much difficulty, but callbacks are tricky. The callbacks originate in the object to be exported. Let's say there are two app contexts, A and B. Class Foo is registered in context A and sometime later app Woogle in context B uses RMI to get a reference to Foo. Class Foo was written to be used over RMI, so it can marshal data and so forth. All we need to do is create the registry and setup the communication path between context A and context B. Now let's say Foo.addListener(Remote listener) is used by Woogle to pass an instance of MyListener. So when class Foo wants to invoke the listener, the instance resides in context B. The only way to make the invocation is to use RMI from context A to invoke a method in an object in context B.
Such is my work. Maybe I'll have more interesting (read: concrete) details in the next few days. That way I can accomplish the task of learning something new at work.
No comments:
Post a Comment