Hello, I am new to this discussion group. I found that there are many good discussion about SCJD exam. It helps me a lot in term of doing the design. However, I did not see any discussion about multi-thread handling. How should we handle the multi-threading for the exam ? Should we create a thread pool in server side ? Where can I find the best reference about creating thread pool ? I found several books talk about it, all of them looks very complicated.
If you choose RMI for a solution, this is all handled for you. Natively RMI has a thread pool, socket reuse and is multi-threaded. Hope this helps. If you choose sockets, you will have to right your own.
I seem to be the only person using serialization here and I agree with Peter - Don't use a thread pool. The simple answer is to have one thread per connected clientas this endures that there are no thread management issues.
Joined: Feb 06, 2003
I am going to use RMI. I have already written a thread pool by following a book. It is nice to know that RMI has already handle the thread pool for me. I will remove the code that I wrote. (It has already be tested without using RMI). Thanks.
Hi John, It's important to know that, even using RMI, you can still run into threading issues. A Thread pool make sure that you're not wasting threads, but it doesn't keep two threads from attempting to modify the same resource. That's where your locking code comes in. HTH, M, author The Sun Certified Java Developer Exam with J2SE 1.4