This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I saw this implementation of the RMI framework earlier in January. I was very puzzled by this code snippet, especially now that I've finished my own implementation. My implementation looks something like the following:
I used "rmic" to create the stub, BusinessService_Stub.class, in the same directory. I look at the tangle of interfaces in your code snippet, and I wonder if I missed an important concept in my implementation. I have the client-server communication established and working, but the implementation is very simple. What am I missing?
I used 2 different implementation classes of the BusinessService, one for standalone mode and another one for networked mode. One of the reasons I used 2 classes is because in networked mode I have to do other things than in stand-alone mode: client identification that is (because my interface doesn't have a lockCookie). Another reason was that in Andrew's book there were also 2 seperate classes
You used 1 class and I think that's a valid approach too as long as you are able to meet this must requirement:
Keep in mind that networking must be entirely bypassed in the non-networked mode.
I made a simple modification to my implementation. I created a BusinessServiceRemote.class and a BusinessServiceLocal.class. Thanks for the suggestion. It's a whole lot easier to develop a consistent way of handling exceptions if you split the BusinessLayer into two classes, one remote and one local. I'm still on track to deliver my solution this week.