This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes standalone with RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "standalone with RMI" Watch "standalone with RMI" New topic
Author

standalone with RMI

Mike Hays
Greenhorn

Joined: May 15, 2009
Posts: 14
Hello all,

I've read some threads recently about creating Service interfaces that can be used in networked and standalone modes.

My GUI controller will have a reference to a Service object that could be a remote stub or a local object. Does it violate spec to use the same class for both modes? I would like to use the Remote object in standalone mode. I would not use any networking but the object I create would be a Remote (object instanceof Remote). Since my assignment says that none of the network server code may be used in standalone mode I'm worried that this might be against the spec.

The alternative I've been reading about is to create a separate RemoteService interface that extends Service. So Service would not be a Remote but its methods would throw RemoteException. Can anyone help me understand why I can't just use the one Remote object in both modes?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5233
    
  12

Hi Mike,

I implemented the alternative, because my approach needed 2 different implementations: the method implementations are different in local and rmi mode.

According to my instructions:
Keep in mind that networking must be entirely bypassed in the non-networked mode.
The ultimate question: what is meant by the word "entirely"? No use of Remote interface or just no network traffic?
As far as I know I don't know of someone using your described approach, so following this approach might be risking automatic failure.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Mike Hays
Greenhorn

Joined: May 15, 2009
Posts: 14
Okay, thanks. I won't risk it.
Kai Witte
Ranch Hand

Joined: Jul 17, 2004
Posts: 356
hello,

I implemented an old version of B&S in 2004, and I got away with it:


Still no guarantee that your spec is phrased differently or simply judged differently ...


Kai Witte's business website Kai Witte's private homepage
Bernd Wollny
Ranch Hand

Joined: May 15, 2006
Posts: 59

Hey Roel,

i think Mike's second alternative would look like Roberto explained here. So, following Roberto's approach is valid and not against the specs i think. It has to be valid, because i changed my client implementation from thick to thin and did it in a very similar way to Roberto...

Regards
Bernd


SCJP 1.4, SCJD/OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5233
    
  12

Bernd Wollny wrote:It has to be valid, because i changed my client implementation from thick to thin and did it in a very similar way to Roberto...
Where did I state the alternative would be invalid? I even said I implemented the alternative

Kind regards,
Roel
Bernd Wollny
Ranch Hand

Joined: May 15, 2006
Posts: 59

Roel De Nijs wrote:Where did I state the alternative would be invalid? I even said I implemented the alternative

Ohhh, to claim that was not the intention of my post. I just wanted to write down that the second approach is a valid one like you mentioned!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: standalone with RMI