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);