HttpBindThread has deadl lock bugh
Brought to you by:
gabriel_whites
Hi
There is an important bug in class HttpBindThread,
The method:
public synchronized void write(final String _s):
can case a thread lock if it is called twice consecutively with short delay between each time.
Analysis.
First time will lunch the thread secondthread and before the method readStanzas is arrived in this thread ,the second call will came and take the lock of object this.
readStanzas will be arrived and suspended waiting for the lock of this object and in same time the write method will stop waiting secondthread to finish.
Solution:
Replace sleep(200) in write method to wait(200) , This will allow to release the lock of this object allowing others methods to take it.
Regards
Mohamed