• 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

Business-level locking mistakes

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


Anything else may fail
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not use finally instead of calling unlock three times?
 
Anton Golovin
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Vess:
Why not use finally instead of calling unlock three times?



I agree. I forgot finally executes no matter what. Sorry.
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anton Golovin:
... code omitted ...
Anything else may fail



Why? If you got a RecordNotFoundException or SecurityException attempting the delete with the record locked, what is the chance that the unlock, which has the same pre-conditions, could possibly succeed? Either of these exceptions at this point in the business logic is fatal.

I close the server and suggest that the user might want to select a different server (or database) as the one she's using is toast.
 
Anton Golovin
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by peter wooster:


Why? If you got a RecordNotFoundException or SecurityException attempting the delete with the record locked, what is the chance that the unlock, which has the same pre-conditions, could possibly succeed? Either of these exceptions at this point in the business logic is fatal.

I close the server and suggest that the user might want to select a different server (or database) as the one she's using is toast.



True, very true. You know, this is just the jitters of waiting I was told the assessor is grading my exam, which (my thought), given 19 classes, could appear scored at any moment
[ October 06, 2004: Message edited by: Anton Golovin ]
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic