File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about RMI and Non-network mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about RMI and Non-network mode" Watch "Question about RMI and Non-network mode" New topic

Question about RMI and Non-network mode

Ching-Tien Chang

Joined: May 31, 2004
Posts: 16
Hi all:

In the assignment requirement:

The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.
The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.

I have finish the network mode part using RMI, here is my system architecture

BusinessModel(extends UnicastRemoteObject implements Remote)
| (communication over network)
client code

I am now implement the non-network mode, but if I try to create a new
instance of BusinessModel without create BusinessModel_Stub and BusinessModel_Skel, a big-fat StubNotFoundException will be thrown.
If my system running in non-network mode but must rely on the existence
of BusinessModel_Stub, am I violate the requirement?
(In non-network, I'm not using any code about binding port or using rmiregstry)

Thanks a lot for answering and happy weekend,
Ching-Tien Chang
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
This is a good reason to think out your architecture first.

What about this instead? This isn't quite right, but it might get you thinking...

Business Functions
/ \
BusinessModel Non-NetworkedModel
| |
Network Direct Interface
client code

ARG: I can't display this on this bulletin board. Lemme try now:

[ July 23, 2004: Message edited by: Robert Konigsberg ]

SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Itapaj� Takeguma
Ranch Hand

Joined: Jul 21, 2004
Posts: 41
I really did not understand what Robert Konigsberg means, but isn't it the case where you could do:

interface DataBase extends Remote
class LocalDataBase implements DataBase
and have a local Data base and when you whant a remote database, you do:

Remote sever = new LocalDataBase()
UnicastRemoteObject.exportObject(server, 0)

Itapaj� takeguma
SCJP 1.4 (91%)
Ching-Tien Chang

Joined: May 31, 2004
Posts: 16
Thanks for Robert Konigsberg and Itapaj� Takeguma's reply and sorry for reply so lately.

I will think about both of your suggestions and post new question here if I still have any question about this.

Chhing-Tien Chang
I agree. Here's the link:
subject: Question about RMI and Non-network mode
It's not a secret anymore!