This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
How a read write lock enabled resource (collection) know which are all are read threads and which all are write threads ?
The collection doesn't know or care if a thread is all read or all write operations. All it knows is which of its own methods are read methods and which of its own methods are write methods. It then protects its own methods with an appropriate lock. So a thread that does all reads will only get read locks, a thread which does all writes gets only write locks, and a thread which reads sometimes and which writes other times will get a read lock when it reads and a write lock when it writes.