• 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

My lock/unlock mechanism

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a RemoteDataFactory in which a getConnection() method has been implemented, so there is a RemoteData object for every client.
The lock and unlock methods have been implemented in Data class with the help of a LockManager. so Data object has a LockManager object.

I've used the 'current thread name' to identify the client. The lock/unlock method of RemoteData object changes the thread name to a unique name. Then it calls the lock/unlock method of the Data object.
Is there any problem with my design? Because I think this would be the only mechanism to identify the client in the Data object's lock/unlock method - without changing the signature..
I'm not locking the records in the local mode.
Please comment on my Locking mechanism.
With regards
Manish Kumar
 
Manish Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it too complicated?
 
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems a bit roundabout to me Manish. Have you thoght about storing the Thread Object itself, instead of it's altered name? That, coupled with a weakHashMap, could be an elegent solution.
All best,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
 
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic