aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Whether the local object and remote object can  implement same interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Whether the local object and remote object can  implement same interface?" Watch "Whether the local object and remote object can  implement same interface?" New topic
Author

Whether the local object and remote object can implement same interface?

Hu Yong Jun
Greenhorn

Joined: Jun 20, 2003
Posts: 26
Could I make the local object and remote object implementing the same interface?



The remote object's remote methods MUST throw RemoteException. I have the following question:
[BOLD] Can the local object method throw RemoteException but do nothing with the RemoteException or it MUST NOT throw RemoteException? [BOLD]

I must two interfaces such as BookingFacadeLocalIF and BookingFacadeRemoteIF if the local and remote object must not share the same interface. That is a very bad design.

[ October 01, 2004: Message edited by: Hu Yong Jun ]
[ October 01, 2004: Message edited by: Hu Yong Jun ]
mike acre
Ranch Hand

Joined: Sep 23, 2003
Posts: 197
Good question.

Personally I believe that no, the local object should not implement an interface that throws RemoteException.

And further more from the clients perspective, in networked mode, it should use a Remote object that doesn't throw a RemoteException, that is to say that the method of Remoteness should be hidden from the client.

The answer lies in the use of Adapters.


SCJP 1.4, SCJD
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Sure it's possible. If your BookingException were to be changed to IOException, then and only then would it work ok.


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Whether the local object and remote object can implement same interface?