Hi all
I have a funny question, might sound stupid but i have got to ask this question. Imagine that i have a Service Interface(Business Layer) where i place by book() and find() methods. Now this is the question:
If i am gonna have the Service Interface(Business Logic), would i have to place "sync" code within read(),update() or delete()? In my business logic i intend to have the client call lock(),update(),unlock() in that sequence in my Book() method. So i am assuming that i wouldnt have to "sync" within these methods? Please correct me if i am wrong, and i would also like a scenario where it could fail if i dont place "sync" code within the methods. Right now this is a scenario i am working with:
My read() "sync"s on the internal cache that holds all the records of contractors and allows only one
thread gain access to the cache and return an array of strings. The pseudocode goes like thus:
Ok that is my read() pseudocode, my update() has something like this:
And my lock() method has the following pseudocode:
Well that is mostly what i have now in my Data.java.
My question is. If i am using the Services Interface and having Book() call lock(), update(),unlock() in that sequence, would i need to put "sync" within update()? Thanks all. I am sorry if this post is too long. Have a nice day all.