ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  10 Reasons We Need Java 3.0
Subject:   Thread support bothers me
Date:   2003-10-17 07:39:19
From:   anonymous2
I may be misguided on this but one of the things that bothers me the most about Java threading is the fact that you cannot stop or suspend a thread. To me that's a serious shortcoming. The reason is that there are too many things out of the realm of control of you the programmer. Perhaps its a poorly written api you have to interface or maybe the db hangs. Yes we like to eliminate these things from happening. However, part of the understanding of writing enterprise software is the understanding that these things can and will happen and our software needs to be prepared to handle it.


Without this functionality I must assume that my all my blocking calls will always return which is like saying I'll never have a bug again. Because of this I can no longer clean up my thread, release it, rebuild a new one, and have my app keep on trucking. Instead I have to come in at 3:00AM in the morning and restart the process or leave the dead threads hanging.


I also understand that cleaning up is a touchy issue. Threads in general are tough to do and so is cleaning up there state but it is something that programmers should learn if they venture into threads. I've written such code in C++ that has allowed my apps to become very durable and survive most any nasty situation.


In my opinion you should be able to stop or kill, throw a exception in the thread, clean up any state issues you have, and let the thread release or continue back processing.


Anyhow my humble 2 cents!