com.bea.jvm
Interface ThreadSystem

All Superinterfaces:
Describable, JVMComponent

public interface ThreadSystem
extends JVMComponent

Interface to the thread system of the JVM.

Author:
Calle Wilund, Marcus Hirt

Method Summary
 java.util.Collection getAllThreads()
          Returns a Collection of all the Threads running in the VM.
 int getDaemonThreadCount()
          Returns the number of daemon threads in the system.
 java.lang.Thread getThread(long id)
          Returns a thread matching the specified id.
 java.util.Collection getThreads(java.lang.String name)
          Returns a Collection with all the threads with the specified name.
 ThreadSnapshot getThreadSnapshot(long id)
          Get a snapshot of a thread in the JVM.
 ThreadSnapshot getThreadSnapshot(java.lang.Thread t)
          Get a snapshot of a thread in the JVM.
 java.util.Collection getThreadSnapshots()
          Returns a Collection of ThreadSnapshots for all the live threads in the JVM.
 java.util.Collection getThreadSnapshots(java.lang.String name)
          Gets snapshots for the threads matching the specified name.
 java.lang.String getThreadStackDump()
          Convenience method returning a thread stack dump for all live threads in the system.
 int getTotalThreadCount()
          Returns the total number of running threads in the system, including daemon threads.
 boolean isUsingThinThreads()
          Returns true if the thread system is using thin treads, false otherwise.
 
Methods inherited from interface com.bea.jvm.JVMComponent
getJVM
 
Methods inherited from interface com.bea.jvm.Describable
getDescription
 

Method Detail

getThreadSnapshots

java.util.Collection getThreadSnapshots()
                                        throws NotAvailableException
Returns a Collection of ThreadSnapshots for all the live threads in the JVM. Note that when this is returned, the threads in the snapshot will have been resumed and may well have terminated.

Note: The snapshot of the threads only includes live threads. Other ones are either just newly created java objects or dead.

Returns:
ThreadSnapshots for all threads in the JVM.
Throws:
NotAvailableException - if this functionality isn't available in the JVM.
See Also:
ThreadSnapshot

getThreadSnapshot

ThreadSnapshot getThreadSnapshot(java.lang.Thread t)
                                 throws NotAvailableException
Get a snapshot of a thread in the JVM. Note that when this is returned, the thread in the snapshot will have been resumed and may have terminated.

Parameters:
t - thread to get a snapshot for.
Returns:
the ThreadSnapshot for the specified thread.
Throws:
NotAvailableException - if this functionality isn't available in the JVM.
See Also:
ThreadSnapshot

getThreadSnapshots

java.util.Collection getThreadSnapshots(java.lang.String name)
                                        throws NotAvailableException
Gets snapshots for the threads matching the specified name. Note that when this is returned, the threads in the snapshot will have been resumed and may well have terminated.

Parameters:
name - the name of the threads to find and get snapshots for.
Returns:
a Collection of ThreadSnapshots for all threads in the JVM matching the name parameter. Will return an empty collection if no threads matching the name could be found.
Throws:
NotAvailableException - if this functionality isn't available in the JVM.
See Also:
ThreadSnapshot

getThreadSnapshot

ThreadSnapshot getThreadSnapshot(long id)
                                 throws NotAvailableException,
                                        NoSuchThreadException
Get a snapshot of a thread in the JVM. Note that when this is returned, the thread in the snapshot will have been resumed and may well have terminated

Parameters:
id - the id of thread to get a snapshot for.
Returns:
a ThreadSnapshot for the specified thread.
Throws:
NoSuchThreadException - if no thread matching the id can be found.
NotAvailableException - if this functionality isn't available in this JVM.

getTotalThreadCount

int getTotalThreadCount()
                        throws NotAvailableException
Returns the total number of running threads in the system, including daemon threads.

Returns:
the total number of running threads in the system (including daemon threads).
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getDaemonThreadCount

int getDaemonThreadCount()
                         throws NotAvailableException
Returns the number of daemon threads in the system.

Returns:
the number of daemon threads in the system.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getAllThreads

java.util.Collection getAllThreads()
                                   throws NotAvailableException
Returns a Collection of all the Threads running in the VM.

Returns:
a Collection of all the Threads running in the VM.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getThreads

java.util.Collection getThreads(java.lang.String name)
                                throws NotAvailableException
Returns a Collection with all the threads with the specified name. Will return an empty collection if no matching thread can be found.

Parameters:
name - the name of thread to find. If name is null, a NullPointerException will be thrown.
Returns:
a Collection with all the threads with the specified name. Will return an empty collection if no matching thread can be found.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getThread

java.lang.Thread getThread(long id)
                           throws NotAvailableException,
                                  NoSuchThreadException
Returns a thread matching the specified id.

Parameters:
id - the thread id of thread to find.
Returns:
the thread matching the specified id.
Throws:
NoSuchThreadException - if no thread matching the id can be found.
NotAvailableException - if this functionality isn't available in this JVM.

isUsingThinThreads

boolean isUsingThinThreads()
                           throws NotAvailableException
Returns true if the thread system is using thin treads, false otherwise.

Returns:
true if the thread system is using thin treads, false otherwise.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getThreadStackDump

java.lang.String getThreadStackDump()
                                    throws NotAvailableException
Convenience method returning a thread stack dump for all live threads in the system. Similar to the string dumped to the console when pressing ctrl-break.

Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.


Copyright © 2006 BEA Systems Inc.