I think the synchronized block is causing a dead end. Because it will not start another thread until it completes. You use the wait() method to wait() for the current thread. Well, it will wait, but since it is in the synchronized block, it will be in the current thread forever so that no other thread appears due to synchronized .
One thing you can do to make another thread work is to use Thread.stop . Try calling the stop method on the current stream link. But I'm not sure if this will allow the current thread to start again.
source share