How Does a Cached Thread Pool Reuse Existing Threads
I've just started looking at Java's Executors class and the newCachedThreadPool( ) method. According to the API, the resulting thread pool reuses existing Thread objects for new tasks. I'm a bit puzzled how this is implemented because I couldn't find any method in the Thread API that lets you set the behaviour of an existing Thread object. For example, you can create a new Thread from a Runnable object, which makes the Thread call the Runnable 's run( ) method. However, there is no setter method in the Thread API that takes a Runnable as an argument. I'd appreciate any pointers. Executors does