- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I can think of a reason why you might do this (a security manager that checks what the stack is before permitting an exit) but it just increases the WTF factor. Please let this just be foolish cargo-cult programming…
Admin
He wanted the exit to be asynchronous :-P
Admin
Yay! Async for everything!
Admin
They had @Override in 2001?
Admin
well, you woudn't want your exit block your process
Admin
my one and only thought on this
Admin
Yes, this code has definitely been touched since 2001.
Admin
Ugh Java, obviously the entire codebase is bad.
Admin
Like node.js - maybe he thought he'd have a callback invoked after the exit was complete ;-)
Admin
"Also Spacke Zarathustra"
You mean "Also Sprach Zarathustra"
Admin
No. I hired Zarathustra to spackle my walls to get a nice textured finish, but then I decided the ceiling needed to match, so he spacke that, too.
Admin
Charles F (unregistered) in reply to Colin Rosenthal 2016-07-28
Yes, this code has definitely been touched since 2001.
Probably just by some script that eliminated compiler warnings.
Jester (unregistered) 2016-07-28 Reply
"Also Spacke Zarathustra"
I was thinking of http://www.dict.cc/?s=Spacken
(If it was the English title of "Also sprach Zarathustra" I'd expect "Thus Spake Zarathustra" - or is this copyrighted?)
Admin
This is actually needed in rare cases, e.g. if jvm shutdown hooks are used (Runtime.getRuntime().addShutdownHook) Threads interrupting/joining each other may lead to some shutdown hooks not being run. Calling shutdown from a different Thread may help to keep Threads from interrupting/joining each other.
Admin
No, birds don't System.exit(0) from eating rice. According to Snopes, they actually love it.
Admin
Relying on shutdownHooks being called or generating deadlocks during a shutdownHook is bad behaviour anyway. Moreover, shutdow hooks are already run on their own threads.
No, I think the idea is that we only exit when there is enough CPU time available to do it :D
Admin
I hope OP cleaned the code properly:
Thread.currenThread().setUncaughtExceptionHandler((t,e)-> System.exit(42)); throw new KillThatBeastThrowable();
there, all lock cleaned :)
Admin
Good point. Though you have to give them credit for cleaning up their compiler warnings. :-)
Admin
Admin
2001? So it hasn't been touched since 1968?
Admin
Also Spank Zarathustra? Any advance?
Admin
My first thought is that maybe there's some high-priority thread that wants to finish its work before this thread tears down the process.
Admin
The only advance I have is advance warning.
Admin
No, 0x2001, as in it won't be touched until the year 8193. This is a probable reconstruction of early 21st century coding patterns by future archaeologists.
Admin
I was once very proud of a tool that kills other processes by attaching a thread to them that will provoke a crash by writing to NULL.
This let me kill tasks otherwise not killable on Windows 98...
Admin
The only spec defined reason to do that (other than weird security config of the JVM) is to postpone execution waiting for a thread to call yield(). A compliant JVM doesn't have to run threads preemptively, they can run cooperatively. It's still a WTF nonetheless.
Admin
Good find, annotations were not available before the end of 2004.