Hitachi

Hitachi Application Server V10 Definition Reference Guide (For UNIX® Systems)


7.13.2 -XX:HitachiThreadLimit

-XX:HitachiThreadLimit specifies the maximum number of threads.

Description

-XX:HitachiThreadLimit specifies the maximum number of threads. The OutOfMemoryError exception is thrown if the number of threads exceeds the specified value. However, if the number of threads exceeds the specified value before Java VM starts, no exception is thrown. In addition, the number of threads does not include threads that were created outside the management range of Java VM by the application by using JNI. If 0is specified, the no maximum value is set.

Note that, if this option and the -XX:+HitachiOutOfMemoryAbort option are specified at the same time, or if the OutOfMemoryError exception is thrown by this option, Java VM will not be forcibly terminated.

In addition, if this option and the -XX:+HitachiOutOfMemoryStackTrace option are both specified, an exception message is output to the Java VM log file.

Output format
Could not create "name" thread. Threadlimit Exceeded. num threads exist.

You can acquire this message by using java.lang.Throwable.getMessage(). Furthermore, if the entire message contains 128 single-byte characters or more, the end of the message is omitted.

Output item

Output content

name

Name of the thread that could not be created

num

Current number of threads

When the -XX:+HitachiOutOfMemoryStackTrace option is specified, the exception information and stack trace can be output to the Java VM log files. The type of the cause of the exception is Thread Limit. The exception cause types are as follows.

Table 7‒10: List of exception cause types

No.

Cause message

Description

1

C Heap

Exception caused when allocating a C heap

2

Java Heap

Exception caused when allocating a Java heap

3

Meta Space

Exception caused when allocating Metaspace

4

Compressed Class Space

Exception caused when allocating Compressed Class Space

5

Unknown

Exception that cannot be identified as one of the above exceptions

6

Thread Limit

Exception caused when the maximum number of threads is specified in the -XX:HitachiThreadLimit option and the number of created threads exceeds the specified maximum number.

Syntax

-XX:HitachiThreadLimit=integer_value

Specifiable values

integer_value

Type: Integer

Specify the maximum number of threads as an integer from 0 to 2147483647. If you specify a value outside of the specifiable range, 0 is set. If you specify a negative value, an error occurs.

Default value

If the definition item is omitted:

-XX:HitachiThreadLimit=0

Example

Could not create "Thread-1" thread. Threadlimit Exceeded. 9 threads exist.

This example shows the message that is extracted by using java.lang.Throwable.getMessage(), when java.lang.Thread.start is called by the main thread and an exception is thrown by this function.

Notes

If you specify a small value for the maximum number, an exception will be thrown before startup. Do not specify a value that is smaller than the number of threads used by the Java EE server.