Java Sleep sleep(Integer seconds)

Here you can find the source of sleep(Integer seconds)

Description

sleep

License

Educational Community License

Declaration

public static void sleep(Integer seconds) 

Method Source Code

//package com.java2s;
/*//from  w ww  . java  2  s . co  m
 * Copyright 2014 University of Washington
 *
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl1.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */

public class Main {
    public static void sleep(Integer seconds) {
        // sanity check
        if (seconds == null || seconds <= 0 || seconds > 60) {
            return;
        }

        try {
            Thread.sleep(1000 * seconds);
        } catch (InterruptedException ex) {
            Thread.currentThread().interrupt();
        }
    }

    public static void sleep() {
        Integer wait = Integer.getInteger("w");
        if (wait == null) {
            wait = Integer.getInteger("wait");
        }

        sleep(wait);
    }
}

Related

  1. sleep(int retryInterval)
  2. sleep(int sec)
  3. sleep(int seconds)
  4. sleep(int sleepInSeconds)
  5. sleep(int toSleep)
  6. sleep(Integer threadWaitInMs)
  7. sleep(long duration)
  8. sleep(long interval)
  9. sleep(long l)