• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Business-level locking mistakes

 
Anton Golovin
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Anything else may fail
 
Mike Vess
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use finally instead of calling unlock three times?
 
Anton Golovin
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • 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.
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • 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: 527
  • Mark post as helpful
  • send pies
  • 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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic