Steven Ingram commented on NETBEANS-2950:

[~lkishalmi], I spent some quality time with this issue today, and It turns it 
may be a bit more complicated than we first figured.  So the issue reported 
here stated that the debugger would reattach after finishing a debugging 
session.  After I stopped that behavior, I found that the build wouldn't stop 
running.  You would have to click on the output window's red button like the 
issue sates as a work around, or click on the process in the bottom right hand 
of the IDE and kill the process that way.  I had to change my investigation 
from the original issue to a new one - why won't the build stop?

When you click "Finish Debugger Session" for a Gradle app, the RequestProcessor 
picks up on it starts the process to remove the Debugger from the session, but 
there's some logic that is keeping that process from happening cleanly.

I made a comparison of how a maven project handled "Finish Debugging".  In 
JPDADebuggerImp.java line 1493, there's a check to the see if the looked up 
implementation of AbstractDICookie is AttachingDICookie.  In the case of a 
maven project that instance is a ListeningDICookie so the case fails and 
execution starts again on line JPDADebuggerImp 1506.  That will use the 
VirtualMachineWrapper to "exit" the VM which leads to the behavior we see when 
we kill the debugging session for maven.

In a gradle app, that logic to check the implementation of the 
AttachingDICookie passes because for gradle the implementation is a 
AttachingDICookie so the logic flows until the VirtualMachineWrapper calls 
"dispose".  That's the difference between the Maven app succeeding the exit and 
gradle not succeeding.  !GradleSuccess.jpeg!

That's a screen shot after I changed the logic to allow the implementation test 
to fail for gradle and use the VirtualMachineWrapper's "exit" method.

I don't have enough domain knowledge yet as to why you would use dispose in one 
instance and exit in another, but as far as I can tell, when "exit" is called 
for maven that's when you see the process disappear from the lower right hand 
corner of the IDE.  

I'm not sure why that logic is dependent upon the AbstractDICookie 
implementation either. 

Can you give me some direction or let me know how you want to proceed.  Ask 
questions for sure.




> Cannot finish app by stopping debugging
> ---------------------------------------
>                 Key: NETBEANS-2950
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-2950
>             Project: NetBeans
>          Issue Type: Bug
>          Components: projects - Gradle
>    Affects Versions: 11.0
>            Reporter: Jaroslav Tulach
>            Assignee: Steven Ingram
>            Priority: Minor
>              Labels: EasyFix
> When I create Gradle/Java Application and try to debug it, it doesn't stop 
> when I press the "Finish Debugging" button. That is weird and certainly 
> different to behavior of Maven and Ant projects. Example:
> {code:java}
> public class Main {
>     public static void main(String[] args) throws Exception {
>         int cnt = 0;
>         while (true) {
>             Thread.sleep(1000);
>             System.out.println("counting " + ++cnt);
>         }
>     }
> }{code}
> Debug the project. Then press the big red button in the debugger toolbar. The 
> debugger disconnects, but immediately reconnects again and the application 
> continues. I find this unexpected. Output of one of my executions:
> {code:java}
> > Task :compileJava
> > Task :processResources NO-SOURCE
> > Task :classes
> > Task :run
> Listening for transport dt_socket at address: 5005
> counting 1
> counting 2
> counting 3
> counting 4
> counting 5
> Listening for transport dt_socket at address: 5005
> counting 6
> Listening for transport dt_socket at address: 5005
> Listening for transport dt_socket at address: 5005
> counting 7
> counting 8
> At the end I pressed the "small red" button in on the left side of the output 
> window and that one terminates the app - e.g. workaround exists.

This message was sent by Atlassian Jira

To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:

Reply via email to