Bear Bibeault wrote:
![]()
Bear Bibeault wrote:You don't need to implement any threads. Why do you think that you do?
Take the example of looking up something in a database for the user.
And let's say that a poorly-written servlet calls some model method that returns the value from the database. So one thread running the servlet looks up the value and stores it. Another thread looks up a different value (for a different user) and also stores it. What happened to the first value? It's gone because the single servlet and it's single instance variable can only store one value at a time. So the first thread has had its data corrupted and could end up showing one user the data for another because the servlet was not thread-safe.
No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
How do you say it would create a problem
No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
Consider Paul's rocket mass heater. |