Appendix B.1 Thread generation process list
(1) GUI related APIs
The following threads are generated by GUI related APIs.
- No specific conditions
- If you use the GUI functionality of AWT or Swing, threads are generated. The GUI related APIs generate maximum six threads in a Java process.
- java.awt.EventQueue class
- One thread is generated for each EventQueue instance.
- java.awt.FileDialog class
- If you invoke the show () method, one thread is generated. A maximum of one thread is generated for each FileDialog instance, when this method is invoked.
- java.awt.image.renderable.RenderableImageProducer class
- If you invoke the startProduction() method, one thread is generated.
- java.awt.print.PrinterJob class
- If you invoke the following methods, one thread is generated:
- print() (both types)
- printDialog() (both types)
- pageDialog() (both types)
- java.awt.TrayIcon class
- If the java.awt.TrayIcon instance is generated in a UNIX environment, one thread is generated for each instance.
- javax.swing.JEditorPane class
- One thread is generated for each JEditorPane instance.
- javax.swing.JFileChooser class
- One thread is generated for each javax.swing.JFileChooser instance.
- javax.swing.JTable class
- If you invoke print() (all five types), one thread is generated.
- javax.swing.Timer
- If you invoke the start() or restart() method, one thread is generated. A maximum of one thread is generated for each Timer instance, when this method is invoked.
- javax.swing.text.LayoutQueue Class
- If you invoke the addTask() method, one thread is generated. A maximum of one thread is generated for each LayoutQueue instance when this method is invoked.
- javax.swing.text.JTextComponent class
- When you invoke print() (all three types), one thread is generated.
- javax.swing.text.AsyncBoxView class
- If you invoke the following methods, a LayoutQueue instance is created inside the API, and a thread is generated in its extension:
- preferenceChanged()
- replace()
- setSize()
- javax.swing.text.html.FormView class
- If you invoke the submitData()method, one thread is generated.
- Using Applet
- If you use Applet in a UNIX environment and a warning icon is displayed, one thread is generated.
- Using the Input method
- If you use the Input method provided in java.awt.im and java.awt.im.spi, threads are generated. There can be a maximum of one such thread in a Java process.
(2) JMX related APIs
The following threads are generated by APIs related with JMX.
- Resource monitoring in SNMP (Simple Network Management Protocol)
- If you monitor or manage resources by using SNMP, maximum nine threads are generated.
- javax.management.remote.rmi. RMIConnection interface
- One thread is generated for each instance of the class that implements the RMIConnection interface.
- javax.management.remote.rmi.RMIConnector class
- If you invoke the connect() (both types) method, two threads are generated for one established connection.
(3) JNDI related APIs
The following threads are generated by APIs related with JNDI.
- No specific conditions
- Two threads are generated for one JNDI context by using the naming and directory operations.
- javax.naming.event.EventContext interface
- If you invoke the addNamingListene() (both types) method of the class that implements the Event Context interface, one thread is generated. Maximum one thread is generated for each directory context when this method is invoked.
(4) RMI related APIs
The following threads are generated by RMI related APIs:
- RMI server-side
- The following threads are generated inside the JavaVM.
- Maximum six threads are generated, when there are no specific conditions. These threads are maintained until the end of the JavaVM process.
- When waiting for connections from the RMI client, generate the threads equal to the number of TCP ports that have exported remote objects.
- If there is a method invocation from the RMI client, one thread is generated to control that method.
- One thread is generated for invoking the unreferenced() method of the remote object that implements the java.rmi.server.Unreferenced interface.
- RMI client side
- Threads equal to the number of connected RMI servers are generated.
(5) Other APIs and functions
The following threads are created by other APIs and functions:
- HTTP/HTTPS communication
- Two threads are generated to control Keep Alive in HTTP/HTTPS communication. There can be a maximum of two such threads in a Java process.
- DNS communication
- If you execute the DNS communication in a Windows environment, one thread is generated.
- There can be a maximum of one such thread in a Java process.
- Explicit execution of finalize
- If you invoke the runFinalization() method of the java.lang.System class or java.lang.Runtime class, one thread is generated.
- Creating an external processes
- If you create external processes by using the java.lang.ProcessBuilder class in UNIX environment, one thread is generated. There can be a maximum of one such thread for each java.lang.Process instance.
- java.nio.channels.Selector class
- If you use the Selector class in Windows environment, one thread is generated each time the number of registrations of the channel to the Selector instance increases by 1,024.
- java.util.prefs.Preferences class
- If you use the Preferences class, one thread is created. There can be a maximum of one such thread in a Java process.
- javax.print.PrintServiceLookup class
- When you use javax.print.PrintServiceLookup, one thread is generated. There can be a maximum of one such thread in a Java process.
- sun.security.pkcs11.SunPKCS11 class
- One thread is created for each sun.security.pkcs11.SunPKCS11 instance.