Karthik Shiraly wrote:
When i run this code, c2.call() does not execute until c1.call() is completed.
I get the impression that you expect each of these call()s to spawn new threads. But that's not how the API is used.
In your current code, there is only *1* thread ever. In that thread, c1.call() puts that single thread to sleep for 5 seconds.
Only after 5 seconds have passed, the CPU starts executing anything further on this thread, which happens to be c2.call().
That's why c2.call() starts only after c1.call() is completed.
The correct way to spawn threads with Callable is using the Executors / ExecutorService class (see tutorial here)