Java AtomicBoolean sleepCheck(int timeout, AtomicBoolean flag)

Here you can find the source of sleepCheck(int timeout, AtomicBoolean flag)

Description

sleep Check

License

Apache License

Declaration

public static void sleepCheck(int timeout, AtomicBoolean flag) throws InterruptedException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.atomic.AtomicBoolean;

public class Main {
    public static void sleepCheck(int timeout, AtomicBoolean flag) throws InterruptedException {
        int timer = 0;
        while (timer < timeout) {
            Thread.sleep(1000);//from  w  ww.j  a v a2s.c o m
            timer++;
            if (flag.get())
                throw new InterruptedException("Interrupt Request Received");
        }
    }
}

Related

  1. isCaseSensitive()
  2. isComplexAddressHandlingEnabled()
  3. isWriteRelativeUris()
  4. remove()
  5. resolveArgReferences(Object arg)
  6. waitForDelayedDrainNotify(AtomicBoolean drainNotifier)