+ Added classes:
+ org.netbeans.api.debugger.jpda.DeadlockDetector
,
+ org.netbeans.api.debugger.jpda.MonitorInfo
,
+ org.netbeans.api.debugger.jpda.ThreadsCollector
+
+ Added methods:
+ CallStackFrame.getFrameDepth()
,
+ CallStackFrame.getOwnedMonitors()
,
+ JPDADebugger.getAllThreads()
,
+ JPDADebugger.getThreadsCollector()
,
+ JPDADebugger.getDeadlockDetector()
,
+ JPDAThread.getCurrentBreakpoint()
,
+ JPDAThread.getContendedMonitorAndOwner()
,
+ JPDAThread.getOwnedMonitorsAndFrames()
,
+ EditorContext.annotate()
with thread argument
+
+ Added fields:
+ JPDADebugger.PROP_THREAD_STARTED
,
+ JPDADebugger.PROP_THREAD_DIED
,
+ JPDADebugger.PROP_THREAD_GROUP_ADDED
,
+ JPDAThread.PROP_SUSPENDED
,
+ JPDAThread.PROP_BREAKPOINT
,
+ EditorContext.OTHER_THREAD_ANNOTATION_TYPE
+
+ * Since JDI interfaces evolve from one version to another, it's strongly recommended + * not to implement this abstract class in client code. New methods can be added to + * this class at any time to keep up with the JDI functionality.+ * + * @author Martin Entlicher + * @since 2.16 + */ +public abstract class DeadlockDetector { + + /** + * Name of property which is fired when deadlock occurs. + */ + public static final String PROP_DEADLOCK = "deadlock"; // NOI18N + + private Set
null
.
+ * @since 2.16
+ */
+ public abstract JPDABreakpoint getCurrentBreakpoint();
/**
* Returns the list of the last operations, that were performed on this thread.
@@ -237,9 +252,26 @@ public interface JPDAThread {
public abstract ObjectVariable getContendedMonitor ();
/**
+ * Returns monitor this thread is waiting on, with the information
+ * about the owner of the monitor.
+ *
+ * @return monitor this thread is waiting on, with the owner.
+ * @since 2.16
+ */
+ public abstract MonitorInfo getContendedMonitorAndOwner ();
+
+ /**
* Returns monitors owned by this thread.
*
* @return monitors owned by this thread
*/
public abstract ObjectVariable[] getOwnedMonitors ();
+
+ /**
+ * Get the list of monitors with stack frame info owned by this thread.
+ *
+ * @return the list of monitors with stack frame info
+ * @since 2.16
+ */
+ List+ * Since JDI interfaces evolve from one version to another, it's strongly recommended + * not to implement this interface in client code. New methods can be added to + * this interface at any time to keep up with the JDI functionality.+ * + * @author Martin Entlicher + * @since 2.16 + */ +public interface MonitorInfo { + + /** + * Returns the acquired monitor object + * + * @return monitor object + */ + ObjectVariable getMonitor(); + + /** + * Returns the frame at which this monitor was acquired by the owning thread. + * + * @return The frame, or
null
when the implementation cannot
+ * determine the stack frame (e.g., for monitors acquired by JNI).
+ */
+ CallStackFrame getFrame();
+
+ /**
+ * Get the owning thread.
+ *
+ * @return the thread.
+ */
+ JPDAThread getThread();
+
+}
+
\ No newline at end of file
diff -r 56bcd6cdfc36 api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ThreadsCollector.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ThreadsCollector.java Fri May 30 16:23:27 2008 +0200
@@ -0,0 +1,107 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.api.debugger.jpda;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.List;
+
+/**
+ * Collector of threads running inside the debuggee.
+ * Fires changes when threads change.
+ *
+ * + * Since JDI interfaces evolve from one version to another, it's strongly recommended + * not to implement this abstract class in client code. New methods can be added to + * this class at any time to keep up with the JDI functionality.+ * + * @author Martin Entlicher + * @since 2.16 + */ +public abstract class ThreadsCollector { + + private final PropertyChangeSupport pch = new PropertyChangeSupport(this); + + /** Property name constant. */ + public static final String PROP_THREAD_STARTED = "threadStarted"; // NOI18N + /** Property name constant. */ + public static final String PROP_THREAD_DIED = "threadDied"; // NOI18N + /** Property name constant. */ + public static final String PROP_THREAD_GROUP_ADDED = "threadGroupAdded"; // NOI18N + + /** Property name constant. */ + public static final String PROP_THREAD_SUSPENDED = "threadSuspended"; // NOI18N + /** Property name constant. */ + public static final String PROP_THREAD_RESUMED = "threadResumed"; // NOI18N + + + /** + * Add a PropertyChangeListener to be notified about threads changes. + * @param l The listener + */ + public final void addPropertyChangeListener(PropertyChangeListener l) { + pch.addPropertyChangeListener(l); + } + + /** + * Remove a PropertyChangeListener. + * @param l The listener + */ + public final void removePropertyChangeListener(PropertyChangeListener l) { + pch.removePropertyChangeListener(l); + } + + protected final void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + pch.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * Returns all threads that exist in the debuggee. + * + * @return all threads + */ + public abstract List
null
, when the annotation can not be
+ * created at the given URL or line number.
+ * @since 2.16
+ */
+ public Object annotate (
+ String url,
+ int lineNumber,
+ String annotationType,
+ Object timeStamp,
+ JPDAThread thread
+ ) {
+ return null;
+ }
/**
* Adds annotation to given url on given character range.