[jboss-svn-commits] JBL Code SVN: r26442 - labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun May 10 17:27:12 EDT 2009


Author: ahtik
Date: 2009-05-10 17:27:10 -0400 (Sun, 10 May 2009)
New Revision: 26442

Modified:
   labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
Log:
Simplistic protection against debugger state sync where getLineNumber is called before thread suspended state is properly propagated in the whole debugger model. Fix will try 10 times to read the line number before giving up. Experimentally for "bad state" cases it took maximum 1-2 retries to retrieve the information, 10 is more for safety. Proper fix is a nice to have but requires extensive debugging.

Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java	2009-05-10 09:41:05 UTC (rev 26441)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java	2009-05-10 21:27:10 UTC (rev 26442)
@@ -325,9 +325,21 @@
 
             int fragmentLine = getBreakpointLineNumber(); // 4->5 for step over
 
+            int retryCount=0;
+            while (fragmentLine==-1 && retryCount<10) {
+                try {
+                    Thread.currentThread().sleep( 100 );
+                } catch ( InterruptedException e ) {
+                    break;
+                }
+                fragmentLine = getBreakpointLineNumber();
+                retryCount++;
+            }
+                
             int res = line + fragmentLine;
 
             cacheLineNumber = res;
+            //System.out.println("Returning RES="+res+" line:"+line+"; fragmentLine="+fragmentLine);
             return res;
         } finally {
             evaluating = false;
@@ -368,6 +380,10 @@
                 }
                 IntegerValue val = (IntegerValue) o;
                 int realval = val.value();
+/*                if (realval==-1) {
+                    System.out.println("-1!!");
+                }
+*/
                 cacheBreakpointLineNumber = realval;
                 return realval;
             } catch ( NullPointerException e ) {




More information about the jboss-svn-commits mailing list