• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Function name requirement !

 
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 ?
 
author
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
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic