Hi,All I met a new problem. I create a thread which will repeatly run in the server to check if there is overtime locks on server. If there are such locks, this thread will release the lock and notifyAll(). BUT, In this scene, Client A locked record 1 but didn't unlock it and A crashed. Client B tried to lock record 1 but found the record had already locked by other so thread of Client B was wait(). AND NOW, the thread I mentioned before found there is a overtime lock(of record 1) and release the lock. BUT when this thread notifyAll(), it can not call the Thread of Client B from wait to run. I have tried many way but found only notifyAll() from Remote(through RMI) can let the wait thread(from remote too) from wait to run. Thread on server can not notify the threads called by Client from remote. Can somebody supplied a solution to resolve the problem of the perivous scene. Thanks in advance!
hi, song i use locktime(System.currentTimeMills()) as my value in a hashtable(the key is recordnumber), so in lock() method, i add a new monitor thread which persist in monitoring that hashtable. the thread will delete over-long time record and notifyAll when it find that hashtable has a over-long time record. the thread is in lock() method, and only once run. how you implement your lock/unlock? Using a hashtable? if so, what is value, locktime, or other? my english is bad, but i hope you can understand what i said. thanks.
I'm not quite sure I follow you. The notifyAll() called by your reaper thread should wake up the thread that handles the call from client B just fine -- it's a Thread like any other, really. Are you sure you are calling notifyAll() on the same object that the calling thread wait()s on? - Peter
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd