[hg] main-silver: #216205: Acquiring of the thread's write lock ...

  • From:
  • To:
  • Subject: [hg] main-silver: #216205: Acquiring of the thread's write lock ...
  • Date: Thu, 15 Nov 2012 16:37:42 -0800

changeset cba9be114a72 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/cba9be114a72
description:
        #216205: Acquiring of the thread's write lock should solve the 
problem with incompatible state during method invocation.

diffstat:

 
debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/RemoteServices.java
 |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (28 lines):

diff --git 
a/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/RemoteServices.java
 
b/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/RemoteServices.java
--- 
a/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/RemoteServices.java
+++ 
b/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/RemoteServices.java
@@ -161,9 +161,11 @@
         Method getContextCl = 
ClassTypeWrapper.concreteMethodByName((ClassType) threadType, 
"getContextClassLoader", "()Ljava/lang/ClassLoader;");
         t.notifyMethodInvoking();
         try {
+            ClassObjectReference basicClass = null;
+            t.accessLock.writeLock().lock();
+            try {
             ObjectReference cl = (ObjectReference) 
ObjectReferenceWrapper.invokeMethod(tawt, tawt, getContextCl, 
Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
             List<RemoteClass> remoteClasses = getRemoteClasses();
-            ClassObjectReference basicClass = null;
             for (RemoteClass rc : remoteClasses) {
                 String className = rc.name;
                 if (basicClass == null && className.indexOf('$') < 0 && 
className.endsWith("Service")) {
@@ -240,6 +242,11 @@
                 // Perhaps it's not 100% correct, we should be calling the 
new class' newInstance() method, not Class.newInstance() method.
                 Method newInstance = 
ClassTypeWrapper.concreteMethodByName(theClass, "newInstance", 
"()Ljava/lang/Object;");
                 ObjectReference newInstanceOfBasicClass = (ObjectReference) 
ObjectReferenceWrapper.invokeMethod(basicClass, tawt, newInstance, 
Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
+                }
+            } finally {
+                t.accessLock.writeLock().unlock();
+            }
+            if (basicClass != null) {
                 synchronized (remoteServiceClasses) {
                     remoteServiceClasses.put(t.getDebugger(), basicClass);
                     t.getDebugger().addPropertyChangeListener(new 
RemoteServiceDebuggerListener());

[hg] main-silver: #216205: Acquiring of the thread's write lock ...

mentlicher 11/16/2012

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close