/** * Return the active thread with the specified id. * * @param threadId The thread id * @return The thread with the specified id or {@code null} if no such thread exists * @throws IllegalArgumentException if the specified id is zero or negative * @throws SecurityException * if the current thread cannot access the system thread group * * @throws SecurityException if the current thread cannot modify * thread groups from this thread's thread group up to the system thread group */ public static Thread findThreadById(final long threadId) { final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId)); return result.isEmpty() ? null : result.iterator().next(); }
/** * Return the active thread with the specified id. * * @param threadId The thread id * @return The thread with the specified id or {@code null} if no such thread exists * @throws IllegalArgumentException if the specified id is zero or negative * @throws SecurityException * if the current thread cannot access the system thread group * * @throws SecurityException if the current thread cannot modify * thread groups from this thread's thread group up to the system thread group */ public static Thread findThreadById(final long threadId) { final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId)); return result.isEmpty() ? null : result.iterator().next(); }
/** * Return the active thread with the specified id. * * @param threadId The thread id * @return The thread with the specified id or {@code null} if no such thread exists * @throws IllegalArgumentException if the specified id is zero or negative * @throws SecurityException * if the current thread cannot access the system thread group * * @throws SecurityException if the current thread cannot modify * thread groups from this thread's thread group up to the system thread group */ public static Thread findThreadById(final long threadId) { final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId)); return result.isEmpty() ? null : result.iterator().next(); }
/** * Return the active thread with the specified id. * * @param threadId The thread id * @return The thread with the specified id or {@code null} if no such thread exists * @throws IllegalArgumentException if the specified id is zero or negative * @throws SecurityException * if the current thread cannot access the system thread group * * @throws SecurityException if the current thread cannot modify * thread groups from this thread's thread group up to the system thread group */ public static Thread findThreadById(final long threadId) { final Collection<Thread> result = findThreads(new ThreadIdPredicate(threadId)); return result.isEmpty() ? null : result.iterator().next(); }