• 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

URLyBird Locking Queries

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I had some queries related to Locking. Please could someone help me on the same?

1. The Locking strategy does not specify any Time out periods though i feel that it is essential. But would implementing that be changing the requirement?
2. If i implement the Time out strategy for locking then there could be a scenario where a person locks a record, updates it and then forgets to unlock. After the timeout i release the lock. But what about the update that is made? Should it be rolled back or must i retain that and commit?

Please could someone shed some light on the same?
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam, if your instructions say that you must make the calling thread give up CPU until the lock is free (like mine) then I suggest you must comply with that rule. There's no point in making the work more complicated, especially when it goes against what is specified in the instructions.

Leo.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't roll back anything if a lock isn't released, I just kill the lock after a timeout period.

In fact I didn't provide for (and it wasn't asked in the assignment) for any rollback capability.
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam,

I don't know how are your specification but in mine thre is no time out specified.
To make some assumptions will increase the code complexity(see Leos post). On ther side which time out you'll choose and how you'll justify it ?

I am not shore that I undersant you point :


I don't roll back anything if a lock isn't released, I just kill the lock after a timeout period.



The time out purpose is to prevent the death locks - if you only release(you use "kill") the lock without release the thread them the thread (or client) is remain in waiting.

Regards, Mihai
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the lock is killed (using the unlock method of course) all threads waiting on it are automatically notified.

The timeout period is configurable, I document the period I chose based on the intended usage pattern of the engine.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeroen,


The timeout period is configurable, I document the period I chose based on the intended usage pattern of the engine.



but how you can be shore that the timeout will work on all paltfroms ? Even if on your test machime(s) is working that does not means that on the examinatotrs macheine(s) will work also.
A configurable timeout is not bad, but to does not fulfill the requrermanets (at leasm mine)

Regards Mihai
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what the versions.txt file is for. It documents the platforms you test your application on.
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot all of you for all the help. I think i will go with Leo. I will not implement the Timeout period but will allow for such changes easily maybe through an interface.
Thanks a lot guys!!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic