• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Locks

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Please can you comment on my locking schema:
1. RemoteDataInterface extends DataInterface
2. RemoteData class implements RemoteDataInterface extends UnicastRemoteObject
3. RemoteData class has a reference to Data class.
4. Added in RemoteData a method called connect() added in DataInterface,RemoteDataInterface, the method is used to
connect to either local or remote database by a client ConnectionFactory. This method creates an entry on the server singletion ConnectionManager which has hashmap in which association between
client thread and remoteData class is made.
5. The RemoteData class also has reference to singleton Lock Manager and locks and unlocks where implemented without signature change. And has another HashMap to (RecordNo,getConnection()).The getConnection returns the association between current thread and RemoteDataInstance.
Please is this design correct and agreeable please please comment on this i have to decide this before i proceed
Regards
Farouk
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Just to clarify things better
LockManager getConnection gets the association between currentthread and RemoteData Instance returned by the ConnectionManager which creates this method using the connect message sent from the client
Please reply if you have any queries regarding my doubt inthe previous message
Farouk
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gurus please help
Farouk
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Farouk, remember that forums are not real time - it may take a while for answers to arrive. Patience is a virtue
In any case, the weakness in your proposal is the association between clients and threads. On the server, there any client request may be serviced by any thread. There are a number of ways I have seen the client identification issue addressed: in no particular order, by simply ignoring it, by modifying the lock() and unlock() signatures, by creating a client-side adapter object that has unmodified Data signatures but delegates to a server-side object that does take client ID arguments, or by giving each clients its own unique connection object. If you search through the forum you will no doubt find even more approaches...
- Peter
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter
I really appreciate your reply and i apologize for the rush.
Why do you say it is a weekness of associating a thread and a remotedata object for client identification. As i understand RMI serves multiple request in multiple threads for the same client.
Can you please tell me in what way it is a weakness
I think my approach is the same as giving each client its own copy of connection object(in my case RemoteData object)
Please reply
Farouk
reply
    Bookmark Topic Watch Topic
  • New Topic