Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I don't think using a file is a very elegant way of doing this. Personally, I plan on using one of the containers in the Collections API in java.util. I haven't decided yet but am considering HashSet. You could then check to see if your Collection already contained a lock on the requested record and if so you could wait() for the lock to be released. Of course everytime a lock is released, you'll need to notifyAll().
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
1. if all the methods are syn. then why we need use of HashSet in lock/unlock?
2. in any case, if object is same and all the methods are syn. then operating on single record means blocking all the threads or you can say locking all the db operations.
A "dutch baby" is not a baby. But this tiny ad is baby sized:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|