Q:
1) In a multi-threading application is there a limit to how many threads an application may spawn.
2)If such a limit exists, does the JVM terminate the application and with what error code.
EDIT
3)If an application spawns in very rapid sucsession, would the JVM detect that as a “rough” application
Thanks in advance
No limit specified by the JVM specification. The OS may (probably) limit it as usual per process etc though.
Each thread will also allocate a stack etc so a lot of memory could be needed, so depending on the computer what limit is hit first..
Please note: Too many threads are usually inefficient though. Your program could/should probably scale better in another way. Using Thread pools (executor service), asynchronous I/O, fork/join etc depending on your needs.
See also:
Is there any hard limit to a number of threads in Java?
How many threads can a Java VM support?