takeBook is synchronized and static, so the lock is on the java.lang.Class object of Library class.
But in takeBook you invoke wait/notify on the (current) Thread instance. And you are not owning...
Type: Posts; User: andbin
takeBook is synchronized and static, so the lock is on the java.lang.Class object of Library class.
But in takeBook you invoke wait/notify on the (current) Thread instance. And you are not owning...
Ok, I can give some more hints:
1) You should have only 1 instance of Library and pass this instance to all PatronThread instances (how to pass the instance is up to you, there are some possible...
You have not posted all the code, so it's not easy to understand the whole architecture of your application. However two things can be clearly and easily spotted in the PatronThread class.
1) You...