public class Threads
extends java.lang.Object
Constructor and Description |
---|
Threads() |
Modifier and Type | Method and Description |
---|---|
static int |
getAvailableProcessors()
Gets the number of available processors (cores).
|
static java.lang.Thread[] |
makeArray()
Returns a new array for threads.
|
static java.lang.Thread[] |
makeArray(double multiple)
Returns a new array for threads.
|
static void |
startAndJoin(java.lang.Thread[] threads)
Starts and joins all threads in the specified array.
|
public static int getAvailableProcessors()
public static java.lang.Thread[] makeArray()
Note that this method does not actually construct any threads.
public static java.lang.Thread[] makeArray(double multiple)
Note that this method does not actually construct any threads.
multiple
- desired number of threads per processor (or core).public static void startAndJoin(java.lang.Thread[] threads)
threads
- array of threads.java.lang.RuntimeException
- if any threads are interrupted.