• Post Reply Bookmark Topic Watch Topic
  • New Topic

an event will be triggered before the program is terminated.  RSS feed

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a program running in eclipse that if I close it using the red square stop button, then an event will be triggered before the program is terminated.
Is this possible?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37462
537
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nikos,
This isn't really specific to Eclipse. You want to know if Java can intercept a kill command - whether it is ctrl-d or through a UI.

I think the answer is no, but I'm moving this to Java In General in case someone can confirm/refute it there.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On another thread, the shutdown hook. Don't know if it works on a kill. Let us know what you find out.

http://www.coderanch.com/t/380047/java/java/Exception-thread-main-java-lang
[ June 01, 2006: Message edited by: Stan James ]
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can confirm that the shutdown hook does work with the cntl-C (a.k.a. SIGTERM). I have never tested it with a SIGKILL though.

Henry
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your advice
 
stephen shields
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you trying to cause event to occur before u terminate
or is ur program actually triggering a new event b4 it terminates?

if a parent event creates a child event, under java the child should close when the parent close.
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something to occur before it terminates
 
stephen shields
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes u can cause something to occur
if you are developing an gui application
i believe you put the code to execute, such as database insertion, etc
in the form closing function.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!