Skip to content
Snippets Groups Projects
Commit 1e218dce authored by Alexis Durgnat's avatar Alexis Durgnat :milky_way:
Browse files

Close messagequeue on exit

parent 1cc8ead8
Branches
Tags
1 merge request!21*poof* final version
......@@ -6,10 +6,13 @@ import ch.hepia.events.*;
import ch.hepia.models.User;
import ch.hepia.mq.MessageManager;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import java.io.IOException;
import java.util.ArrayList;
......@@ -42,6 +45,18 @@ public class Main extends Application {
stage.setScene(scene);
stage.show();
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Platform.exit();
try {
appContext.getMessageManager().close();
} catch (Exception e){
System.exit(1);
}
System.exit(0);
}
});
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment