aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/lang/management/ThreadMXBean.java
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
commite1bea0c0687c5f4551b3a6058ec37ce3705fa6cc (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/java/lang/management/ThreadMXBean.java
parentaf333b9a7f9e1cc1029bec56d48f2de63acdf686 (diff)
downloadgcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.zip
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.gz
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.bz2
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. From-SVN: r125302
Diffstat (limited to 'libjava/classpath/java/lang/management/ThreadMXBean.java')
-rw-r--r--libjava/classpath/java/lang/management/ThreadMXBean.java167
1 files changed, 156 insertions, 11 deletions
diff --git a/libjava/classpath/java/lang/management/ThreadMXBean.java b/libjava/classpath/java/lang/management/ThreadMXBean.java
index 669cb3c..f73075d 100644
--- a/libjava/classpath/java/lang/management/ThreadMXBean.java
+++ b/libjava/classpath/java/lang/management/ThreadMXBean.java
@@ -57,20 +57,30 @@ package java.lang.management;
* <p>
* This bean supports some optional behaviour, which all
* virtual machines may not choose to implement. Specifically,
- * this includes the monitoring of the CPU time used by a
- * thread, and the monitoring of thread contention. The former
- * is further subdivided into the monitoring of either just
- * the current thread or all threads. The methods
+ * this includes the monitoring of:
+ * </p>
+ * <ul>
+ * <li>the CPU time used by a thread</li>
+ * <li>thread contention</li>
+ * <li>object monitor usage</li>
+ * <li>ownable synchronizer usage</li>
+ * </ul>
+ * <p>
+ * The monitoring of CPU time is further subdivided into
+ * the monitoring of either just the current thread or all
+ * threads. The methods
* {@link #isThreadCpuTimeSupported()},
- * {@link #isCurrentThreadCpuTimeSupported()} and
- * {@link #isThreadContentionMonitoringSupported()} may be
+ * {@link #isCurrentThreadCpuTimeSupported()}
+ * {@link #isThreadContentionMonitoringSupported()},
+ * {@link #isObjectMonitorUsageSupported()} and
+ * {@link #isSynchronizerUsageSupported()} may be
* used to determine whether or not this functionality is
* supported.
* </p>
* <p>
- * Furthermore, both these facilities may be disabled.
- * In fact, thread contention monitoring is disabled by
- * default, and must be explictly turned on by calling
+ * Furthermore, both time and contention monitoring may be
+ * disabled. In fact, thread contention monitoring is disabled
+ * by default, and must be explictly turned on by calling
* the {@link #setThreadContentionMonitoringEnabled(boolean)}
* method.
* </p>
@@ -82,6 +92,70 @@ public interface ThreadMXBean
{
/**
+ * This method returns information on all live threads at the
+ * time of execution (some threads may have terminated by the
+ * time the method completes). This method is simply a shorthand
+ * for calling {@link #getThreadInfo(long[], boolean,
+ * boolean)} with the return value of {@link #getAllThreadIds()}.
+ *
+ * @param lockedMonitors true if the returned {@link ThreadInfo}
+ * objects should contain information on
+ * locked monitors.
+ * @param lockedSynchronizers true if the returned {@link ThreadInfo}
+ * objects should contain information
+ * on locked ownable synchronizers.
+ * @return an array of {@link ThreadInfo} objects for all live threads.
+ * @throws SecurityException if a security manager exists and
+ * denies ManagementPermission("monitor").
+ * @throws UnsupportedOperationException if <code>lockedMonitors</code>
+ * is true, but object monitor
+ * usage monitoring is not supported
+ * by the VM, or
+ * <code>lockedSynchronizers</code>
+ * is true, but ownable synchronizer
+ * usage monitoring is not supported
+ * by the VM.
+ * @since 1.6
+ * @see #getThreadInfo(long[], boolean, boolean)
+ * @see #getAllThreadIds()
+ * @see #isObjectMonitorUsageSupported()
+ * @see #isSynchronizerUsageSupported()
+ */
+ ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
+ boolean lockedSynchronizers);
+
+ /**
+ * <p>
+ * This method obtains a list of threads which are deadlocked
+ * waiting to obtain monitor or ownable synchronizer ownership.
+ * This is similar to the behaviour described for
+ * {@link #getMonitorDeadlockedThreads()}, except this method also
+ * takes in to account deadlocks involving ownable synchronizers.
+ * </p>
+ * <p>
+ * Note that this method is not designed for controlling
+ * synchronization, but for troubleshooting problems which cause such
+ * deadlocks; it may be prohibitively expensive to use in normal
+ * operation. If only deadlocks involving monitors are of interest,
+ * then {@link #findMonitorDeadlockedThreads()} should be used in
+ * preference to this method.
+ * </p>
+ *
+ * @return an array of thread identifiers, corresponding to threads
+ * which are currently in a deadlocked situation, or
+ * <code>null</code> if there are no deadlocks.
+ * @throws SecurityException if a security manager exists and
+ * denies ManagementPermission("monitor").
+ * @throws UnsupportedOperationException if the VM does not support
+ * the monitoring of ownable
+ * synchronizer usage.
+ * @since 1.6
+ * @see #findMonitorDeadlockedThreads()
+ * @see #isSynchronizerUsageSupported()
+ */
+ long[] findDeadlockedThreads();
+
+ /**
* <p>
* This method obtains a list of threads which are deadlocked
* waiting to obtain monitor ownership. On entering a synchronized
@@ -115,13 +189,17 @@ public interface ThreadMXBean
* of A and B. Note that this method is not designed for controlling
* synchronization, but for troubleshooting problems which cause such
* deadlocks; it may be prohibitively expensive to use in normal
- * operation.
+ * operation. This method only returns deadlocks involving monitors;
+ * to include deadlocks involving ownable synchronizers,
+ * {@link #findDeadlockedThreads()} should be used instead.
* </p>
*
* @return an array of thread identifiers, corresponding to threads
- * which are currently in a deadlocked situation.
+ * which are currently in a deadlocked situation, or
+ * <code>null</code> if there are no deadlocks.
* @throws SecurityException if a security manager exists and
* denies ManagementPermission("monitor").
+ * @see #findDeadlockedThreads()
*/
long[] findMonitorDeadlockedThreads();
@@ -285,6 +363,53 @@ public interface ThreadMXBean
ThreadInfo[] getThreadInfo(long[] ids);
/**
+ * Returns information on the specified threads with full
+ * stack trace information and optional synchronization
+ * information. If <code>lockedMonitors</code> is false,
+ * or there are no locked monitors for a particular thread,
+ * then the corresponding {@link ThreadInfo} object will have
+ * an empty {@link MonitorInfo} array. Likewise, if
+ * <code>lockedSynchronizers</code> is false, or there are
+ * no locked ownable synchronizers for a particular thread,
+ * then the corresponding {@link ThreadInfo} object will have
+ * an empty {@link LockInfo} array. If both
+ * <code>lockedMonitors</code> and <code>lockedSynchronizers</code>
+ * are false, the return value is equivalent to that from
+ * <code>{@link #getThreadInfo}(ids, Integer.MAX_VALUE)</code>.
+ * If an identifier specifies a thread which is either non-existant
+ * or not alive, then the corresponding element in the returned
+ * array is <code>null</code>.
+ *
+ * @param ids an array of thread identifiers to return information
+ * on.
+ * @param lockedMonitors true if information on locked monitors
+ * should be included.
+ * @param lockedSynchronizers true if information on locked
+ * ownable synchronizers should be included.
+ * @return an array of {@link ThreadInfo} objects matching the
+ * specified threads. The corresponding element is
+ * <code>null</code> if the identifier specifies
+ * a thread that doesn't exist or is not alive.
+ * @throws IllegalArgumentException if an identifier in the array is
+ * <= 0.
+ * @throws SecurityException if a security manager exists and
+ * denies ManagementPermission("monitor").
+ * @throws UnsupportedOperationException if <code>lockedMonitors</code>
+ * is true, but object monitor
+ * usage monitoring is not supported
+ * by the VM, or
+ * <code>lockedSynchronizers</code>
+ * is true, but ownable synchronizer
+ * usage monitoring is not supported
+ * by the VM.
+ * @since 1.6
+ * @see #isObjectMonitorUsageSupported()
+ * @see #isSynchronizerUsageSupported()
+ */
+ ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,
+ boolean lockedSynchronizers);
+
+ /**
* Returns information on the specified thread with
* stack trace information to the supplied depth. If the
* identifier specifies a thread which is either non-existant
@@ -390,6 +515,26 @@ public interface ThreadMXBean
boolean isCurrentThreadCpuTimeSupported();
/**
+ * Returns true if the virtual machine supports the monitoring
+ * of object monitor usage.
+ *
+ * @return true if the monitoring of object monitor usage
+ * is supported by the virtual machine.
+ * @since 1.6
+ */
+ boolean isObjectMonitorUsageSupported();
+
+ /**
+ * Returns true if the virtual machine supports the monitoring
+ * of ownable synchronizer usage.
+ *
+ * @return true if the monitoring of ownable synchronizer usage
+ * is supported by the virtual machine.
+ * @since 1.6
+ */
+ boolean isSynchronizerUsageSupported();
+
+ /**
* Returns true if thread contention monitoring is currently
* enabled.
*