• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Nx Locking a deleted record for later create()

 
Charles Ohene
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I created a locking mechanism where even a deleted record or the end of db could be locked. This ensures that the position for a later record creation is threadsafe locked.
When locking a marked deleted (or empty position like end of db), a RecordNotFoundException is thrown, otherwise not.
That means my create() looks like:
searchFreePos()
lockFreePos() and catch RecordNotFoundException
writeRecToPos()
unlockPos()
________________________________________________
In case that db is full, the end of db is locked

For simplicity, the recNo equals the returned lockcookie. Does this design makes sense to you or did I missed anything? Do you know someone who did it like this? Thanks for your value answers and thoughts
[General Infos: I use 3tier design and an extra LockManagerClass]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic