Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32033
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-07-15 05:11 -0700 |
| References | (9 earlier) <mo3gkj$fas$1@dont-email.me> <8314ba27-cbb9-49ae-a4b5-9e8401d0a747@googlegroups.com> <mo3jj8$ra9$1@dont-email.me> <59qaqa1k1mjipouiaq5jq5aqnr191bk8n1@4ax.com> <mo3qh1$nhj$1@dont-email.me> |
| Message-ID | <fc59d335-b9c6-474a-bb92-94f6ecba3e36@googlegroups.com> (permalink) |
| Subject | Re: javax.swing.Timer blocking program termination |
| From | e.d.programmer@gmail.com |
On Tuesday, July 14, 2015 at 4:14:59 PM UTC-4, Eric Sosman wrote: > The snipped piece said that EXIT_ON_CLOSE is bad because it calls > System.exit(). > > And it said System.exit() was bad because it stops the JVM. > > And it said stopping the JVM was bad because, um, well, actually > it didn't say *why* stopping the JVM was bad, it just said it was. > > In other words, the snipped portion was the same as the quoted > part, just in, well, other words. > > Personally, I like applications that stop. When they keep on > running with no windows open, no user interaction, nothing but the > occasional background burbling as the CPU stalls for another cache > miss ... Well, that's eerie, that's what that is. When I close my > application's main window, I want my application to Go Away. If > it's got no state that needs preserving, EXIT_ON_CLOSE is a perfectly > good way to accomplish this. If there *is* state, I'll use a > WindowAdapter, do whatever's necessary, and then call System.exit() > myself. > > Evil or not, here I come. > > -- > esosman@comcast-dot-net.invalid > "Don't be afraid of work. Make work afraid of you." -- TLM I did say, it's like turning off your computer by holding the power button. That may work just fine. If you're running your OS screen with no applications doing anything it may never appear to be a problem. It's not the proper way to do it. There's a shutdown option in Windows that runs cleanup to avoid corruption. As I said a stopAllTimers method could be useful and you say that's a bad idea, that may not be a problem if you know there are no timers running that couldn't just be terminated. System.exit() kills the system, the JVM. It ends all timers and bypasses all other cleanup. It destroys any and all frames no matter what they may be doing or what their close method is assigned. Just use the proper procedure and there won't be a problem. Tell the frame to DISPOSE_ON_CLOSE and have the window close listener stop all timers that need to be stopped. I tested this and didn't see the timer do anything after the window close no matter what the timer interval. You just keep pressing your power button to end your computer session and hope there's no side effects. I just hope I never have to use a program you wrote.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-13 16:03 -0700
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-13 20:27 -0400
Re: javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-13 17:46 -0700
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-13 21:35 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-13 22:13 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-13 22:27 -0400
Re: javax.swing.Timer blocking program termination e.d.programmer@gmail.com - 2015-07-14 06:31 -0700
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 10:15 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 10:22 -0400
Re: javax.swing.Timer blocking program termination e.d.programmer@gmail.com - 2015-07-14 07:39 -0700
Re: javax.swing.Timer blocking program termination Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-14 10:53 -0400
Re: javax.swing.Timer blocking program termination e.d.programmer@gmail.com - 2015-07-14 10:16 -0700
Re: javax.swing.Timer blocking program termination Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-14 13:25 -0400
Re: javax.swing.Timer blocking program termination e.d.programmer@gmail.com - 2015-07-14 10:45 -0700
Re: javax.swing.Timer blocking program termination Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-14 14:16 -0400
Re: javax.swing.Timer blocking program termination Gene Wirchenko <genew@telus.net> - 2015-07-14 12:56 -0700
Re: javax.swing.Timer blocking program termination Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-14 16:14 -0400
Re: javax.swing.Timer blocking program termination e.d.programmer@gmail.com - 2015-07-15 05:11 -0700
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-15 08:33 -0400
Re: javax.swing.Timer blocking program termination Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-15 18:46 +0000
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-15 21:18 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-15 22:13 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 10:55 -0400
Re: javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-14 08:17 -0700
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 11:42 -0400
Re: javax.swing.Timer blocking program termination Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-14 18:35 +0000
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 15:17 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 15:36 -0400
Re: javax.swing.Timer blocking program termination Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-14 15:51 -0400
Re: javax.swing.Timer blocking program termination Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-14 21:51 +0000
Re: javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-14 15:08 -0700
Re: javax.swing.Timer blocking program termination Martin Gregorie <martin@address-in-sig.invalid> - 2015-07-15 01:16 +0000
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 16:09 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 18:32 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 18:34 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 20:31 -0400
Re: javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-14 08:16 -0700
Re: javax.swing.Timer blocking program termination Joerg Meier <joergmmeier@arcor.de> - 2015-07-14 08:32 +0200
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-14 22:18 -0400
Re: javax.swing.Timer blocking program termination Jeff Higgins <jeff@invalid.invalid> - 2015-07-15 08:26 -0400
Re: javax.swing.Timer blocking program termination Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-15 11:05 -0700
csiph-web