• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

To those who are using a connection Factory, help me out please

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Can you let me know if my reasoning is correct ? Thanx
I tried to replace my rmiregistry bound RemoteDataImpl object with a "Connection Factory", now I'm not sure I see things correct...
My original design was :
db package
----------
- all classes provided by Sun
- DataInterface extends Remote contains all public Data methods throwing base class Exceptions
- LockManager nested within Data Class
- Data implements DataInterface
server package
--------------
- RemoteDataImpl extends UnicastRemoteObject implements DataInterface : methods throw RemoteException besides DatabaseExceptions and IOExceptions
RemoteDataImpl wraps a Data object and delegates all method calls
- Server : binds RemoteDataImpl to RMIRegistry
client package
--------------
- LocalDataImpl implements DataInterface. Methods throw exceptions stated in Data methods,no RemoteException.
LocalDataImpl also wraps a Data object and also delegates all method calls to this Data object
- DataProxy implements DataInterface, methods throw base class Exceptions.
Has 2 ctors : 1 for local, 1 for remote. Wraps LocalDataImpl or RemoteDataImpl depending on ctor of choice
As you can see I even used a LockManager in local mode because it was accessed via Data object
Also, changing the lock/unlock signatures was necessary

When I want to use a Connection Factory I have to achieve :

DataInterface no longer extends Remote nor throws base class Exceptions, just throwing DatabaseExc and IOExc.
RemoteDataImpl (this is the same as your Connection Object, right ??!!) no longer throws RemoteExceptions.
It still wraps a Data object, but one initialized by the connection factory (enters via ctor) (**)
- delegates lock/unlock to a Singleton LockManager's lock/unlock
- implements serializable
RMIRegistry bound ConnectionFactory returning new RemoteDataImpl objects, provided with a reference to the Data object(**)
Is this the correct way to do it ??
Thanks !!!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually in mine, the ConnectionFactory and the "Connection" objects it returns are separate classes. The ConnectionFactory only has a constructor, which calls super()
Then the main which:
1. makes an instance of itself
2. creates the registry
3. makes a Data instance
4. Binds the factory into the registion
Then there is the getConnection method which creates an instance of your remote implementation, passing the Data instance to it constructor. and then returns the remote implementation to the client.
Mark
[ April 12, 2002: Message edited by: Mark Spritzler ]
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic