To use "blocking" code you must be running in a Java thread. You cannot "block" the main javascript thread. Generally all of our code runs on a Java thread. For JS events (which always occur on the main JS thread, I just wrap in new Thread(()->{...}).start();