public Boolean test() throws InterruptedException {
BlockingQueue<Boolean> booleanHolder = new LinkedBlockingQueue<>();
new Thread(() -> {
try {
TimeUnit.SECONDS.sleep(2);
booleanHolder.put(true);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
return booleanHolder.poll(4, TimeUnit.SECONDS);
}