List of usage examples for java.lang Thread currentThread
@HotSpotIntrinsicCandidate public static native Thread currentThread();
From source file:Main.java
public static String getThreadSignature() { Thread t = Thread.currentThread(); long l = t.getId(); String name = t.getName();// ww w . jav a2s . com long p = t.getPriority(); String gname = t.getThreadGroup().getName(); return (name + ":(id)" + l + ":(priority)" + p + ":(group)" + gname); }
From source file:Main.java
public static void sleep(long time) { try {/*from w w w .j ava2 s .c o m*/ Thread.currentThread(); Thread.sleep(time); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:Main.java
public synchronized static Long getCurrentThreadID() { return (Long) Thread.currentThread().getId(); }
From source file:Main.java
public static ThreadGroup getThreadRoot() { ThreadGroup root = Thread.currentThread().getThreadGroup(); while (root.getParent() != null) { root = root.getParent();/*from ww w . j a v a 2 s .com*/ } return root; }
From source file:Main.java
public static int getCurrentThreadId(int capacity) { return (int) (Thread.currentThread().getId() % capacity); }
From source file:Main.java
public static StackTraceElement getCallerStackTraceElement() { return Thread.currentThread().getStackTrace()[5]; }
From source file:Main.java
public static long sleep(long time) { try {//w ww . j a v a2s. c o m Thread.currentThread(); Thread.sleep(time); } catch (InterruptedException e) { System.out.println("[ThreadUtils]-thread sleep error!"); e.printStackTrace(); } return time; }
From source file:Main.java
public static boolean isMainThread() { return Thread.currentThread() == Looper.getMainLooper().getThread(); }
From source file:Main.java
public static ThreadGroup getRootThreadGroup() { ThreadGroup group = Thread.currentThread().getThreadGroup(); while (null != group.getParent()) { group = group.getParent();//from w w w. j av a2 s . c om } return group; }
From source file:Main.java
public static long getId() { return Thread.currentThread().getId(); }