2
peternameyakj
2024-08-14 9bcf85f8d8f9b503e386a67924f5943cd77bd813
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package kernel.util;
 
public class ThreadUtils {
    
    private static ThreadLocal<?> localVar;
 
    @SuppressWarnings("unchecked")
    public static <T> T getThreadLocal() {
        if (localVar == null) {
            localVar = new ThreadLocal<T>();
        }
        return (T) localVar;
    }
 
    public static void sleep(long millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
 
}