List of usage examples for java.lang Thread currentThread
@HotSpotIntrinsicCandidate public static native Thread currentThread();
From source file:Main.java
public static void v(String tag, String message) { if (LEVEL <= VERBOSE) { StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3]; if (TextUtils.isEmpty(tag)) { tag = getDefaultTag(stackTraceElement); }//from w ww . j a v a2s . co m Log.v(tag, getLogInfo(stackTraceElement) + message); } }
From source file:Main.java
public static boolean isInterrupted() { return isInterrupted(Thread.currentThread()); }
From source file:com.vico.license.util.rsa.RSAdoDecrypt.java
public static String decrypt(String cryptograph) throws Exception { Key privateKey;//from w ww .j a va 2 s . co m String path = Thread.currentThread().getContextClassLoader().getResource("/").toURI().getPath(); ObjectInputStream ois = null; try { /** ? */ ois = new ObjectInputStream(new FileInputStream(path + FileNames.PRIVATEKEY_NAME)); privateKey = (Key) ois.readObject(); } catch (Exception e) { throw e; } finally { ois.close(); } /** Cipher?RSA */ Cipher cipher = Cipher.getInstance(ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, privateKey); /** ? */ byte[] b1 = Base64.decodeBase64(cryptograph); /** ? */ byte[] b = cipher.doFinal(b1); return new String(b); }
From source file:Main.java
public static StackTraceElement[] getAllStackTraceElement() { return Thread.currentThread().getStackTrace(); }
From source file:Main.java
public static StackTraceElement getCurrentStackTraceElement() { return Thread.currentThread().getStackTrace()[3]; }
From source file:Main.java
public static Thread[] getThreads() { Thread currentThread = Thread.currentThread(); ThreadGroup threadGroup = currentThread.getThreadGroup(); while (threadGroup.getParent() != null) { threadGroup = threadGroup.getParent(); }/*from ww w. ja v a2s . co m*/ int threadCountGuess = threadGroup.activeCount(); Thread[] threads = new Thread[threadCountGuess]; int threadCountActual = threadGroup.enumerate(threads); while (threadCountActual == threadCountGuess) { threadCountGuess *= 2; threads = new Thread[threadCountGuess]; threadCountActual = threadGroup.enumerate(threads); } return threads; }
From source file:Main.java
public static boolean isUIThread() { return Thread.currentThread() == mUiThread; }
From source file:Main.java
public static final boolean isInSafeThread(final Thread safeThread) { return Thread.currentThread().equals(safeThread); }
From source file:Main.java
private static String getFunctionName() { StackTraceElement[] sts = Thread.currentThread().getStackTrace(); if (sts == null) { return null; }//from w w w. jav a 2s . c om for (StackTraceElement st : sts) { if (st.isNativeMethod()) { continue; } if (st.getClassName().equals(Thread.class.getName())) { continue; } if (st.getFileName().equals("LogUtils.java")) { continue; } return "[" + Thread.currentThread().getName() + "(" + Thread.currentThread().getId() + "): " + st.getFileName() + ":" + st.getLineNumber() + "]"; } return null; }
From source file:com.mycompany.match.gender.app.PersonModel.java
static HashMap<String, Person> getPersonsData() throws IOException { InputStream in = Thread.currentThread().getClass().getResourceAsStream("/data/name_email_sample.csv"); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); Iterable<CSVRecord> records = readCsv(reader); for (CSVRecord record : records) { Person person;// w w w . ja v a 2s . c o m if (record.getRecordNumber() != 1) { if (record.size() > 1) { person = new Person(record); persons.put(record.get(9), person); } } } return persons; }