Created
February 21, 2013 13:27
-
-
Save pfirpfel/5004720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MaxThreads { | |
private static int count = 0; | |
public static void main (String[] args){ | |
while(true){ | |
Thread t = new Thread(new T(), ++count + ""); | |
t.start(); | |
System.out.println(count + ""); | |
} | |
} | |
} | |
class T implements Runnable { | |
@Override | |
public void run() { | |
try { | |
Thread.sleep(Long.MAX_VALUE); | |
} catch (InterruptedException e) { | |
System.err.println(e.getMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My PC stopped add around 120k threads AND I managed to recover my system ;)