fixing bug wit waiter imap
This commit is contained in:
parent
aa103cbf5f
commit
badbe47bc4
1 changed files with 10 additions and 0 deletions
|
|
@ -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<T> {
|
||||
|
|
@ -37,6 +39,14 @@ public class ImapEvent<T> {
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue