From badbe47bc48ab31ae2f9ee365e245ff3c6e640e1 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 14 Nov 2022 14:01:39 +0300 Subject: [PATCH] fixing bug wit waiter imap --- .../ru/spcex/clearing/account/utils/ImapEvent.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java index a59e6d06b..095e18a2b 100644 --- a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java @@ -5,6 +5,8 @@ import com.hazelcast.map.listener.EntryAddedListener; import com.hazelcast.map.listener.EntryRemovedListener; import com.hazelcast.map.listener.EntryUpdatedListener; +import java.util.Timer; +import java.util.TimerTask; import java.util.concurrent.atomic.AtomicBoolean; public class ImapEvent { @@ -37,6 +39,14 @@ public class ImapEvent { } public void waitHappened() throws InterruptedException { + //running timer task as daemon thread + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + checkEventHappened.set(true);//если что-то пойдет не так не тормозить основной поток + } + }, 0, 60 * 1000); synchronized (checkEventHappened) { while (!checkEventHappened.get()) { checkEventHappened.wait(100);