Java RMI Resources
Asked Answered
T

10

12

I am currently undertaking a project that involves extensive use of Java RMI and I was wondering if anyone is aware of any good resources about it.

The problem I am having with the material I am finding currently is that its usually quite out of date (like Java 1.3) and / or half complete. I would even be happy to buy a book on it but looking on Amazon all the books are like 7 years old.

So if anyone is aware of any good resources, books or good example implementations I would be very interested to hear about them.

Turro answered 2/1, 2009 at 18:17 Comment(0)
L
9

RMI Hello World looks nice for a start. Of course it's still a simple example, so maybe tips on RMI performance/scalability will be useful since you're already familiar with RMI.

Lovemaking answered 3/2, 2009 at 9:31 Comment(1)
Cheers for this one tips on RMI performance/scalability looks very promising.Turro
T
5

The Java.RMI has changed very little over the years, so most of the old documentation can still be referenced. Note that one significant change is the need to compile the RMI stubs if you are using a version of Java 5.0. Most people have moved away from RMI and have embraced River (previously called Jini) for distributed systems.

If you are still thinking of moving forward with RMI then I would suggest reading the Oracle documentation or posting your questions on their forums.

As for books… Java RMI by William Grosso or Java Network Programming by Elliotte Harold.

Tattan answered 28/1, 2009 at 21:24 Comment(3)
Jini and RMI are compltely different layers. Jini usually uses RMI as its communications protocol, and AFAIK it's anything but widely adopted.Marston
JINI doesn't specify anything about a communications protocol. that is it's best feature. Using JINI over RMI would work, but is a lot less interesting than over run-time networks.Ecumenism
Very few people have 'embraced' either Jini or River as a matter of fact, and RMI is still the basis for J2EE.Jehu
A
4

RMI hasn't changed that much. I think 1.3 era books will be just fine.

Aborn answered 2/1, 2009 at 18:28 Comment(0)
T
3

Thank you all for your answers I think what people said about RMI not having changed much is correct, however the tutorials could still be a bit better they gloss over some important points.

In the end the best book by far that I found, that covers some of the really good bits of RMI such as Activation was Java Network Programming and Distributed Computing.

I did look at the other O'reilly Java RMI book and in my opnion its not very good at all, for anything bigger than the smallest of RMI projects.

Turro answered 3/2, 2009 at 8:56 Comment(0)
V
3

If you are going to make heavy use of RMI, I would suggest having a look at Spring Remoting. It helps a lot in abstracting the remoting protocol, help you switch remoting implementation later if you need to (for example switch to Hessian, or SOAP).

One thing to keep in mind if you use RMI or any other remote object protocol, is that you can generate a lot of traffic by calling methods on remote objects. It might not be obvious in your code that those objects are remote. It might generate performances problems.

If you can, I would advise you to have a architecture more or less service oriented, where you call remote services to get data object, but not to have too much behaviour on those objects ...

Volley answered 3/2, 2009 at 9:19 Comment(0)
W
2

Have you tried Sun't RMI tutorial? The Sun tutorials are all very good, and they're usually the first place I start for learning anything about Java.

A book that we used in school that has good example code is J2EE Developer's Handbook. Bear in mind that this is a huge reference book of about 1500 pages with only one chapter (about 50 pages) on RMI.

Wild answered 28/1, 2009 at 21:29 Comment(0)
B
1

The O'Reilly RMI book is pretty good. Go for it.

Bev answered 3/1, 2009 at 15:5 Comment(3)
An quotation from te book "A context is a subcontext of another context if it is either a direct subcontext or a subcontext of a context that is a subcontext of the containing context".Translucid
Translation? Every context is a subcontext unless it's at the top of the tree - no parents.Bev
So why didn't they say that, instead of all the gobbledegook? I haven't found O'Reilly books to be much chop, over a period of nearly 30 years.Jehu
L
1

Absolutely invaluable article on multi homed RMI (hosts with multiple IPs) Explains RMI in a very easy to understand way and goes into the issues of hosting registries on machines with more than a single IP address and how private IPs can be dealt with too. Saved my bacon.

Here is the article with Images from the way back archive.

Lithometeor answered 1/10, 2010 at 7:9 Comment(1)
Link is broken.Jehu
W
0

In addition to the ones already mentioned, the article Understanding Java RMI Internals was quite decent IMHO, going a little bit through the internals.

Webbing answered 3/2, 2009 at 13:33 Comment(2)
Link is broken.Jehu
I updated the link to https version, works now for meWebbing
B
0

Here is another good example of remote method invocation with Redisson framework:

Let's assume YourServiceImpl contains method you need to invoke remotely and implements YourService interface.

YourServiceImpl should be registered in Redisson via RemoteService object:

YourService yourService = new YourServiceImpl();

RRemoteService remoteService = redisson.getRemoteService();
remoteService.register(YourService.class, yourService);

To invoke method remotely only service interface is needed:

RRemoteService remoteService = redisson.getRemoteService();
YourService service = remoteService.get(YourService.class);

MyObject result = service.myMethod(someParam1, someParam2);

Also it supports asynchronous calls.

// async interface for YourService
@RRemoteAsync(YourService.class)
public interface YourServiceAsync {

    RFuture<Long> someMethod1(Long param1, String param2);

    RFuture<Void> someMethod2(MyObject param);

}

RRemoteService remoteService = redisson.getRemoteService();
YourServiceAsync asyncService = remoteService.get(YourServiceAsync.class);

RFuture<Long> res = asyncService.someMethod1(12L, "param");
res.thenApply(r -> {
 ...
});

More details here

Bohol answered 4/6, 2016 at 8:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.