• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Locking Question with cancel ???

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am currently doing the URLyBird assignment, and something has me sorta stumped.
I understand how to lock, but the real problem if anyone was making a locking system with Sun's specifications for the CPU to do nothing till it is unlocked, the user would want a cancel button.

Should i try and implement a cancel button to stop waiting but the only way i can think to do that currently is by the client creating a new connection and disconnecting the old one. The reason why i say this is cause currently in my code the server connection won't listen again till after the lock method has finished. and by disconnecting on my server will cause that connection to release any locks on any Records, but having a client disconnect and reconnect seems like a really bad way to have a program.

does any one have any ideas around this problem or should i just not have a cancel button but as you all know this means the client program will tend to hang while waiting for the lock record.

any help would be greatly appriciated
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you need a Cancel button. The only reason the client should be doing a lot of waiting is in a deadlock scenario, which I would advise you to prevent. Yes, the client has to wait on the lock, but the lock should only be active when a record is being updated, and that will take such a short amount of time that ordinarily no one will notice.

In fact, if you add a Cancel button, I think you will have a tough time testing it because the record won't be locked long enough

Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic