Runnable may call another Runnable.
Each thread starts only one main Runnable, but Runnable accepts Runnables from the general BlockingQueue and calls them until it completes.
This is simplified.
final BlockingQueue<Runnable> queue = ...
Runnable runs = new Runnable() { public void run() {
while(running)
queue.take().run();
}};
You can read the code to find out how it does it.
source
share