// shall I write some keywords here to boost search engine ranking?

Wednesday, September 28, 2005

Understand Thread before you code

I had been writing plenty of multi-thread Java programs. However, I only understand the concept of Thread few months ago.

My biggest misunderstanding on Thread is that thinking multi-thread is running on multiple instance of the Thread. This cause me to produce some Thread that is not thread-safe.

When I am debugging a servlet that having session overwrite problem, I come across this article: "Write Thread-Safe Servlets". I was stunt with the truth of Thread. All thread is based on same instance!!!

Although is talking about Servlet, but the concepts there can apply to others Java programming as well. Highly recommended, "Write Thread-Safe Servlets".

No comments: