Serev Nikolaisen

Greenhorn
+ Follow
since Nov 17, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Serev Nikolaisen

I tested the design described in my previous post and at looks like it will work.

When it comes to the IOException and standalone mode I think it will be OK since my client implementation will be "mode independent" and only work against the Adapter interface.

Thanks for the help!
The tutorial explains the basics, but I'm still a bit confused on how to solve this for the assignment.

I guess something like the solution in this thread is the way to go: https://coderanch.com/t/183727/java-developer-SCJD/certification/NX-DBAccess-RemoteException

In my example it will look something like:

DatabaseInterface
DatabaseImpl
AdapterDatabaseInterface
DatabaseRemoteInterface extends Remote, AdapterDatabaseInterface
DatabaseRemoteImpl extends UnicastRemoteObject implements AdapterDatabaseRemoteInterface
DatabaseLocalImpl extends AdapterDatabaseInterface

DatabaseInterface and AdapterDatabaseInterface have the same methods but the Adapter in addition throws IOException on all methods

DatabaseRemoteImpl and DatabaseLocalImpl both holds an instance of the DatabaseImpl

Does this look like an ok design ? The only thing worrying me is the IOException I have to catch in the standalone mode.

[ November 17, 2008: Message edited by: Serev Nikolaisen ]
[ November 17, 2008: Message edited by: Serev Nikolaisen ]
Thanks, but the url gives me "page not found"

Edit: But after deleting the last . if works
http://java.sun.com/docs/books/tutorial/rmi/server.html
[ November 17, 2008: Message edited by: Serev Nikolaisen ]
Ok.. my mistake.. IOException is super to RemoteException

But.. If I don't want the DatabaseInterface methods to throw exceptions.. How should I design the Remote Interface/Impl so the "remote methods" is able to throw RemoteException ?
It looks like the IOException thrown in all DBClient methods is the reason for the book example to work.

If I remove IOException or replaces it with a custom Exception the IDE gives me an error.

So.. What is the magic RMI link between IOException and RemoteException ?

Andrew ?
Hello!

I'm following the "SCJD Exam" book and are trying to implement a RMI test following the factory pattern explained in the book. Should be fairly easy but I run into some trouble

I have the following classes/interfaces:

DatabaseInterface
DatabaseRemoteInterface extends Remote, DatabaseInterface
DatabaseRemoteImpl extends UnicastRemoteObject implements DatabaseRemoteInterface

In DatabaseRemoteImpl I have to throw RemoteException according to RMI. But when I declare the methods my IDE says I can't throw RemoteException because it's not valid according to the throw declarations in the DatabaseInterface (which DatabaseRemoteInterface is inheriting from)

What am I missing ? The guys in the book adds RemoteException to the methods in DvdDatabaseImpl