Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

What will the client side lock() method do?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to know how you cope with the client side lock() method?
My idea is if the client side will lock a record, it will use lock(int) method to lock the record, inside this method, it will
call the server side's lock() method, and it will wait there until the server side returns successfully. Then I've two questions about this process:
1.how to block the client side method when it's waiting for the server's response
2.What if the connection corrupted, while the record is still in
lock in the server side? Do I need to set some timer to unlock the locked record?
What are the other ideas about the client side lock()?
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jun,
1) this is done automatically. You call something on the server and the client is blocked until the server side method returns
2) if you use the notion of a DB session (one remote session object per client) your remote session will be garbage collected by the DGC. You can use the finalize method to unlock all records locked by this session
HTH
rainer
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would shoot to have the server side impl of the lock use Java's thread locking mechanism. That way your method call won't return until the server impl gets wind of the lock acquisition.
Kerry
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need for a lock on Client Side.
Regards
Anurag Mishra
 
A wop bop a lu bop a womp bam boom! Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic