diff --git a/api.debugger.jpda/apichanges.xml b/api.debugger.jpda/apichanges.xml --- a/api.debugger.jpda/apichanges.xml +++ b/api.debugger.jpda/apichanges.xml @@ -689,6 +689,27 @@ + + + Improve threading model. + + + + + + ReadWriteLock is introduced to synchronize the access to JPDAThread. + ReadLock of that read/write pair is publicly available through the + new method JPDAThread.getReadAccessLock(). Clients can use this lock + to assure that the thread is not resumed in the mean time. +

+ Added methods:
+ JPDAThread.getReadAccessLock(), +

+
+ + +
+ diff --git a/api.debugger.jpda/manifest.mf b/api.debugger.jpda/manifest.mf --- a/api.debugger.jpda/manifest.mf +++ b/api.debugger.jpda/manifest.mf @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.api.debugger.jpda/2 OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties -OpenIDE-Module-Specification-Version: 2.17 +OpenIDE-Module-Specification-Version: 2.18 OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager] diff --git a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDAThread.java b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDAThread.java --- a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDAThread.java +++ b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDAThread.java @@ -45,6 +45,7 @@ import com.sun.jdi.ThreadReference; import java.beans.PropertyChangeListener; import java.util.List; +import java.util.concurrent.locks.Lock; import org.netbeans.spi.debugger.jpda.EditorContext; import org.netbeans.spi.debugger.jpda.EditorContext.Operation; @@ -89,7 +90,20 @@ * @since 2.16 */ public static final String PROP_BREAKPOINT = "currentBreakpoint"; - + + /** + * Getter for the "read" lock under which it's guaranteed that the thread + * does not change it's suspended state. + * + * Multiple threads can acquire this "read" lock at the same time. But the + * thread state can be changed only under an internal "write" lock. + * Clients can use this lock while retrieving data to assure that the thread + * is not resumed in the mean time. + * + * @return The read access lock. + * @since 2.18 + */ + public Lock getReadAccessLock(); /** * Getter for the name of thread property.