package com.mscott.timer;

import javafx.application.Application;
import javafx.stage.Stage;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;

public class MainApplication extends Application {

    private AbstractApplicationContext context;

    @Override
    public void start(Stage primaryStage) throws Exception {

        context = new AnnotationConfigApplicationContext("com.mscott.timer");

        HostServicesWrapper hostServicesWrapper = context.getBean(HostServicesWrapper.class);
        hostServicesWrapper.setHostServices(getHostServices());

        WindowManager windowManager = context.getBean(WindowManager.class);

        windowManager.showMainWindow();
    }

    @Override
    public void stop() throws Exception {
        context.close();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

@@ -20,16 +20,66 @@
 timer;%0A%0A
+import com.mscott.timer.scheduling.TurnScheduler;%0A
 import j
@@ -885,16 +885,358 @@
 ption %7B%0A
+        // stop the turn scheduler to ensure any child threads started by the timer are terminated before exiting,%0A        // if this isn't done then the application window closes but the process continues running until its killed%0A        TurnScheduler turnScheduler = context.getBean(TurnScheduler.class);%0A        turnScheduler.stopTurn();%0A%0A
         

Fix Shutdown Bug