Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Should RemoteConnection extend LocalConnection?

Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an two interfaces,


Then i have..

-this class behaves as an adapter, to adapt the Data interface to the Connection interface. They have the subtle difference that Connection throws an IOException when operations are performed on it.
This class basically delegates the work on to Data.

Then my RemoteConnectionImpl operates identically to LocalConnection with the exception of the lock and unlock methods.
Would it not make sense for RemoteConnectionImpl to extend LocalConnection and override the lock methods? It can export itself rather than extending UnicastRemoteObject. We are saying that a RemoteConnectionImpl is a LocalConnection which can be remotely exported.
After all, the server object is always a connection to a local database, but we are just saying that it also implements to declare that can also be exported remotely.
Therefore, the class declaration would be:
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a bad idea @ all. I can see you going either way with it. However, in a real world application, I probably wouldn't do it. Reason? I'd like for my RemoteConnection class and my LocalConnection class to be able to grow /evolve without having side effects on each other.
Let nothing stop you! Not even this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic