Java RMI
The Scoop
Remote Method Invocation (RMI) is the object-oriented remote procedure call (ORPC) facility for distributed programming in Java, since the 1.1 days. RMI also served as motivation and a proof-of-concept for jini, javaspaces, and numerous other solid distributed networking technologies. Of course, anyone from the academic distributed programming world knows Wollrath, Waldo, and Riggs.
Yet, despite a myriad of books over the past five years on network programming, RMI always seemed to be the stepchild: relegated to a single chapter (buried on page 496, of course) that always said that RMI was "better" than sockets and "worse" than CORBA. Now, granted that RMI is operationally rather trivial compared with CORBA and was (prior to RMI/IIOP) a unilanguage distributed ORPC technology -- but still. For those of us who have to interoperate with RMI (whether welcome from the Java world or not), the lack of in-depth technical analysis (beyond the spec) has been a hindrance.
Fortunately, this trend is finally starting to buckle with the release of several in-depth RMI books including: Java RMI, Java.rmi, and Mastering RMI: Developing Enterprise Applications in Java and EJB. As evidence of this problem, Grosso states the same in his introduction – and actually pulls it off without sounding self-serving.
I chose Grosso's text because of the cute squirrel (aka the O'Reilly brand), Grosso's recent series of articles on the hashbelt algorithm, and his unadulterated academic knowledge management and mathematics bent. Fortunately, I was rewarded: this animal returns to O'Reilly's pre-bubble quality. Koodoos to both Grosso and his editors (Knudsen, Loukides, and Eckstein) for getting the train back on the track.
What's to Like
Bottom line is that Grosso simply covers the topics and does so with solid conceptual and code coherence – even by O'Reilly standards (over 40 animals grace my shelves). His prose and explanatory patterns make it clear that he has actually gotten into the real-world of RMI, and doesn't hesitate to highlight both good and bad parts. You cannot be dozing off when you read this (at least not if you expect to understand it) -- this is written by someone with solid analytic thinking skills and it shows. After too many years of "there are no caveats" journalism and publishing, this is a nice reversion. Further, I can only imagine that his current employment is a testament to his real-world knowledge of RMI.
Grosso hits on a vein which is not well-appreciated: when not smoothed over by marketing people, RMI is actually a mostly-capable ORPC technology. Certainly activation and RMI/IIOP really began to make things interesting, from Java2 and EJB respectively. Discussion of reference-counted distributed garbage collection, a feature missing from CORBA and other popular ORPC standards, also contributes a nice bonus (although Grosso's ardent attempt to debunk the "RMI doesn't scale" argument is rather weak, even going so far as to rehash the definition of Threads and threadpools – this complexity mismatch is an ugly giveaway that a well-intentioned editor went astray).
What sets this text apart is the tight focus on nitty-gritty implementation details of RMI itself. After all, these RMI texts are way too late to the game to reteach how to write "baby RMI" code: 5 years after the original spec, you either know how to write RMI or you don't. Grosso simply gives you a solid in-depth analysis of all the obscurities of the RMI runtime, custom sockets, dynamic classloading, activation, MarshalledObjects, and HTTP tunneling. In other words, all the interesting real-world topics whose official documentation is poor and which the various RMI tutorials (written many years ago) ignored.
While canonical, the single banking example followed through the text was well-executed, although authors continue to underestimate the prevalence of readers who consume textbooks non-linearly.
What's Not to Like
RMI/IIOP is shaping up to be a fascinating contributor to the "cleanup the EJB mess" discussion. Dedicating a measly 13 pages (beginning on page 503, no less) to this critical topic seems a bit of an oversight – but maybe that is just my CORBA sentiments speaking. Either way, the mechanics of CORBA are sufficiently intricate in real-world deployments that saying "if you can build an RMI system, you can build a CORBA system" (p. 511) is a bit brazen (or naïve) for my tastebuds. I can only chalk up this oversight to deadline pressure, which is probably a Good Thing, since the book was supposedly in production over almost 2 years.
A minor point: the top-level organization of the book (Part I, II, III) is arbitrary, ignore it -- use the chapter organization instead.
The Summary
Quality: solid practical insight into the nitty-gritty operational implementation details of RMI in the real-world. You simply are not going to find solid O'Reilly-quality coverage of the topics elsewhere.
Relevance: If you are responsible for making RMI actually work in production systems, this might well be the next animal on your shelf – either now or later. If you want a breezy afternoon saunter around RMI, skip this. Instead, google one (of the many) free tutorials online."
You can purchase Java RMI from Fatbrain. Want to see your own review here? Just read the book review guidelines, then use Slashdot's handy submission form.
Having come from a background of Servlet/JSP development, I was quite surprised to see that RMI lacked what I consider a basic feature of distributed computing - authentication and session tracking; this forced me to develop my own, but this is obviously a common need and should be handled by the RMI runtime. I haven't worked with CORBA beyond a couple toys to learn the system, but my understanding is that CORBA does have these feature.
The book itself is excellent - I purchased it after starting to work on a large project with RMI, and realizing that a couple online tutorials wouldn't cut it. The advanced section isn't quite as advanced as I had hoped, but overall the book is a decent reference.
take your sig and shove it
Does the author discuss RMI security and RMI over SSL? If he does, it would be a welcome advantage to the book that probably should've been mentioned in the review. RMI over SSL (via JSSE, for example) is one of the new features that Sun offers, for which only very shallow documentation is available.
Enterprise JavaBeans, and Session Beans in particular, provide these services. RMI is used as the transport layer, and the application server (EJB container) handles authentication and session tracking, often along with redundancy, administration, and a host of other goodies...
While I haven't read the book being reviewed, I know that "Mastering RMI" by Rickard Oberg is one of the best resources on the subject. Rickard is one of the brightest people out there, and he's made waves throughout the enterprise Java world. He's responsible for some of the genius of JBoss, among other things (he came up with the dynamic proxy trick that means JBoss doesn't require stub classes). Check his book out, it's worth it.
XML-RPC is just another way to do what RMI and CORBA do--except it uses XML to encapsulate the data (including the call you are making). RMI was nice when it came out, but I haven't seen it mentioned in a long time. Where I'm working right now they would probably just use XML-RPC or SOAP simply because it is open and can be used by a wider variety of systems (like those OpenVMS machine they have sitting around). I personally use XML-RPC and SOAP and they are great if you have to parse things for the web on the other site. I used to pull a ton of RDF feeds from NewsIsFree, but they screwed it up and only started feeding the updates to the channel. I rewrote the calls using their XML-RPC engine which is much better. I then parse the tree and convert it into RDF for my website. Very slick technology.
Judging from the TOC of the book, I'm surprised that the author didn't deal more with the "why should you use RMI over some other technology?" He does cover the CORBA vs. RMI choice, but that was it. I also don't know how "new" this book is--especially if those topics (SOAP, XML-RPC) weren't covered.
-J
I'm seriously considering using ACE for a cross-platform networking layer in a dstributed system I'm designing. I note that this also has an ORB thingy called TAO (which may just use DCOM/CORBA/RMI depending on the platform). So that may be another option to consider in the interim, i.e. rather than decide which ORB to back right now.
So check out ACE (It's Open Source of course) at http://www.cs.wustl.edu/~schmidt/ACE.html
and TAO at http://www.cs.wustl.edu/~schmidt/TAO.html
.
Here's some blurb:
TAO is an open source product with zero cost licensing.(Development and run time.) TAO is a C++, CORBA 2.3 compliant ORB designed for real-time but equally applicable in general-purpose situations. TAO runs across multiple O/Ss and chip architectures enabling a wide integration capability, for diverse elements, within a single ORB implementation. TAO's baseline design for real time considerations ensures end to deterministic behavior and leverages both system and network characteristics.