A very simple way to avoid deadlock while using N threads is to impose an ordering on the locks and force each thread to follow that ordering. Thus, if all threads lock and unlock the mutexes in the same order, no deadlocks can arise.
Java - Interview
Java Interview Java Script
Thursday, 3 August 2017
IMP - Difference between Callable and Runnable in Java - Interview question
The major difference between Callable and Runnable interface is that Callable can return the result of an operation performed inside call() method, which was one of the limitations with Runnable interface.
The Callable interface can throw checked exception because it's call method throws Exception.
Link One
The Callable interface can throw checked exception because it's call method throws Exception.
Link One
What is blocking method in future ?
Future provides get() method to get result, which is blocking method and blocks until result is available to Future
Link One
Link One
Subscribe to:
Posts (Atom)