This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 245284 - JavaFX application still running after terminate
Summary: JavaFX application still running after terminate
Status: REOPENED
Alias: None
Product: javafx
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Roman Svitanic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-27 10:41 UTC by aplatypus
Modified: 2017-05-19 18:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Small clock program - does NOT terminate when run from NetBeans (13.47 KB, application/zip)
2014-06-28 10:25 UTC, aplatypus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aplatypus 2014-06-27 10:41:29 UTC
Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_05
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.5-b02



I have a small JavaFX application which runs a Thread via ScheduledExecutorService.scheduleAtFixedRate()

I run the application from the Run menu. Run Main Project [F6]

When I terminate the application -- Click eXit.  Program terminates OK and the 

On the NetBeans status bar, the program is still showing as Running.  The Run tab is still active. 

 The JAR file is locked and you can't build until the application is killed manually.

I think NetBeans is "preserving" the context, even though the application should be completely closed and terminated.

This can be a major problem as it prevents new builds and if you later run or debug, you find that you are running with OLD code, not the source code you have just edited.
Comment 1 Roman Svitanic 2014-06-27 11:22:28 UTC
I can't reproduce the issue, please make sure that you are calling Platform.exit() when you are terminating your Java FX application.
If you would be still able to reproduce the problem, please attach some small sample project where it can be reproduced and reopen this issue. Thanks.
Comment 2 aplatypus 2014-06-28 10:25:29 UTC
Created attachment 147815 [details]
Small clock program - does NOT terminate when run from NetBeans


I have attached a example for the problem.  The MainApp calls Platform.exit() in the Stop() method.  I've tracked that in the debugger.

There are two issues to resolve:

  1. There must be a way for shutting down the MainApp (Application) class.  Without hangovers.

  2. Netbeans should stop any errant program still running after it has been told is exited.  It is not detecting or letting the program continue.

Comments welcome, but that's the whole program.  Window 64 bit with jre 8 u5.  I've seen problems with 64-bit that don't show in 32-bit before.
  
Thanks ... Will
Comment 3 aplatypus 2014-06-29 14:02:58 UTC
Hi -- I have found some measure or resolution.  My code needed to call the 

   *  ScheduledExecutorService.shutdown()

Method for active schedulers (see example below).  

However, I think Netbeans can identify that a program is in "over-run" time after it exist.  

I think it should at least report that as an error so programmers are at least alerted to the situation.  

----------------

public class MainApp extends Application
 {

     @Override
     public void start(Stage stage) throws Exception
     { 
        .....
     }

         /**
          *  Close down the application
          *  @see
          *   -- http://docs.oracle.com/javafx/2/api/javafx/application/Application.html#stop%28%29
          **/
      @Override
      public void stop()
      {
          Platform.exit();
          for( ScheduledExecutorService sched : activeExecutorServices )
          {
              sched.shutdown();
          }
      }
Comment 4 Roman Svitanic 2014-07-01 08:32:40 UTC
I have tried to run the attached sample application. Running from the command line outside the NetBeans followed by the exiting the application also does not terminate the application. Therefore it is definitely not a problem of the IDE. Thanks for the understanding.
Comment 5 Exilor 2017-05-19 17:45:13 UTC
I've found this to be a problem too. I have called Platform.exit(); on stop.