A graceful termination of the application, either in response to some input or by internal logic. Usually applied for applications that need to run certain code in order to terminate in consistent way.
Questions tagged [application-shutdown]
170 questions
8
votes
3 answers
What is the correct way to add a Shutdown Hook for an Eclipse RCP application?
I have an RCP application that uses a connection to a in-memory database. There is one circumstance that, when shutting down windows, the application is killed without giving it a chance to close the connection to the database.
I researched a…

Mario Ortegón
- 18,670
- 17
- 71
- 81
7
votes
6 answers
WPF application is not closing correctly
I am calling Application.Current.Shutdown() from a class that is bound to xaml windows with ObjectDataProvider, but the application is not closing. Can anyone help me to understand why? My application is not closing completely after my main window…

Arsen Mkrtchyan
- 49,896
- 32
- 148
- 184
7
votes
5 answers
contextDestroyed() vs addShutdownHook()
I'm currently implementing ServletContextListener and using contextDestroyed() to run cleanup tasks on my web application before it shuts down. However, I've been reading about how Runtime.addShutdownHook(Thread) can be used for the same…

Paul Bellora
- 54,340
- 18
- 130
- 181
7
votes
1 answer
Controlling Spring Boot graceful shutdown
Is there a way in Spring Boot to control the graceful shutdown of the app?
I know that you can have @PreDestroy methods in beans, but how can you control the ordering in which those @PreDestroy methods are called?
You can have multiple beans…

simonC
- 4,101
- 10
- 50
- 78
7
votes
3 answers
Application.Current.Shutdown() doesn't
Title's about it. WPF app with some WCF stuff for IPC. I call Application.Current.Shutdown() and the app continues on happily. I thought Shutdown was supposed to be unstoppable.
Perhaps because it's being called from a background thread? Do I…

Thomas
- 3,348
- 4
- 35
- 49
6
votes
1 answer
Python - How to detect when user closes a console application via "X" button
I currently have a Console based python program running under windows. The program maintains most of its data in memory and periodically saves the data to disk, or when the user shuts the application down via a Keyboard interrupt (Ctrl + C)…

LgZ-optical
- 61
- 1
- 2
6
votes
2 answers
Intercepting java machine shutdown call?
Is there any way to get notified of JVM shutting down or System.exit call before the actual shutdown? I want this, so my application will be able to make a clean exit.
I realize that such thing is unlikely to exist, but still, maybe there is…

Rogach
- 26,050
- 21
- 93
- 172
6
votes
2 answers
Diagnosing IIS Shutdowns
Symptoms:
I attach a debugger, I wait a little while, it automatically detaches
I watch the event log during normal operation - after a single request comes in, it waits a little bit, the shuts down
Disagnosing. I've followed the following steps…

Tom Ritter
- 99,986
- 30
- 138
- 174
5
votes
6 answers
How to save variables after application shut down?
I want to save some integers after application shut down and restore them after application opening, what is the easiest way to do this?

vburojevic
- 1,666
- 5
- 24
- 34
5
votes
2 answers
Application.Current.Shutdown(-1) not closing WPF app
I am checking if the windows authenticated user is a valid user for my wpf application or not.
If not, I need to shut down the application; but even after executing Application.Current.Shutdown(-1) the application keeps on executing happily.
The…

Relativity
- 6,690
- 22
- 78
- 128
5
votes
5 answers
Prompt user to save when closing app
I'm writing what boils down to a document editor. When the application is closing, I need to prompt the user to save changes. This is easy enough. My question is when is it appropriate to not prompt the user, and instead simply discard unsaved data…

Jon B
- 51,025
- 31
- 133
- 161
5
votes
1 answer
notify View(Models) of closing the program
So I got my prism/mvvm/mef program running nicely along, the user is entering data in the application, then closes the application (or shuts down the computer).
How can I get my View(Model) notified of the program closing / the computer shutdown, so…

Sam
- 28,421
- 49
- 167
- 247
5
votes
0 answers
ThreadPoolTaskExecutor keep running, how to control shutdown?
I am writing spring boot app with ThreadPoolTaskExecutor.
Here is my Application class:
import info.gandraweb.apns.service.MessageService;
import info.gandraweb.apns.settings.AppSettings;
import org.slf4j.Logger;
import…

gandra404
- 5,727
- 10
- 52
- 76
5
votes
3 answers
How to properly quit application, call exit(0)?
I'm not sure which is the right way, right now I'm just calling exit(0) when a user clicks on the exit button.

Teo Choong Ping
- 12,512
- 18
- 64
- 91
4
votes
2 answers
Register all interface instances to some global container
I need to shutdown alot of differently implemented threads which only have some Shutdown interface in common. I don't want to pass some global collection through the entire code and add newly created threads manually, because it is guaranteed to be…

Franz Kafka
- 10,623
- 20
- 93
- 149