posted 20 years ago
I have an two interfaces,
and..
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: