Having this wait declaration:
public final native void wait(long timeout) throws InterruptedException;
It could exit by InterruptedExceptio
Exception is not thrown on notify and time out.
I think it's better to rely on java.lang.concurrent package synchronisation objects instead of using Object.wait().
java.lang.concurrent
Object.wait()