• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Function name requirement !

 
Shivaji Bhosale
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi group, as requirements says, public methods from Data has to
be called from client.Now because of my design I have a slight
problem, I just want to know, is my approach acceptable ?
Let me explain,
I have Data extended by 2 classes,
One is for remote operation &
other is for Standalone operation.
Now while I call public methods of a Data class, from client,
those methods must throw RemoteException. Hence, those methods,
are present at server, for Standalone & distributed mode, with
different throws clause. It also I want to say is, those methods,
which are public, were part of original Data.java, now present
in its derived class.
But implementation (say for example delete)is same in both the cases,
I called super.delete, for that I called from client, deleteRecord.
I cannot call delete method because, in Data, I will have to put
RemoteException clause in throws, which is unacceptable in standalone
behaviour.
My Qn is, Is it allowed to call public methods for server with different
name of function from client ?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Sun means exactly the same methods, with the same signature. A few remarks:
  • The root methods (in Data, in your case) should throw RemoteException. That is simply an expression of the fact that their implementation can be either local or remote.
  • Even if the base class (or interface) method throws RemoteException, it is perfectly acceptable for a subclass not to do so. So the local implementation can override the signatures not to throw RemoteException.
  • Shouldn't your Data be an interface?
  • - Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic