r/javahelp • u/feralalien • Oct 09 '15
Having trouble using the ReentrantReadWriteLock
I seem to be having trouble getting ReentrantReadWriteLock to work. I have done it as far as I can tell, correctly, but my audit method seems to be happening during the move method resulting in inconsistent values. From my understanding this should not be happening because a read lock should wait until the write lock has released. Any insight would be very appreciated!
5
Upvotes
View all comments
Show parent comment
2
u/0x68656c6c6f Oct 09 '15
I would leave it if you can but I understand if it's a homework assignment that you might not want to.
One thing I noticed was that your audit isn't guaranteed to occur in between each transaction (unless you also do it in the Transaction code).
Also, check out this page on representing money: http://www.javapractices.com/topic/TopicAction.do?Id=13