threadutil.java

来自「java编写的OCR软件」· Java 代码 · 共 41 行

JAVA
41
字号
package de.spieleck.util;

/**
 * Very simple helpers for delaying Threads.
 * @author fsn
 */
public class ThreadUtil
{
    /**
     * A sleep, that does not throw an exeception and
     * might sleep too short.
     */
    public static void sleep(int ms)
    {
        try
        {
            Thread.sleep(ms);
        }
        catch ( InterruptedException ignore )
        {
            // We just proceed, that is the contract.
        }
    }

    /**
     * A sleep, that does not throw an exeception and
     * might sleep too short.
     */
    public static void sleep(int ms, int ns)
    {
        try
        {
            Thread.sleep(ms, ns);
        }
        catch ( InterruptedException ignore )
        {
            // We just proceed, that is the contract.
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?