Mutithreading

How synchronization can be done for multithreading environment without using the "synchronized" keyword?

Questions by RishiV

Showing Answers 1 - 18 of 18 Answers

Use java.util.concurrent package

Lock mylock;
try
{
mylock.lock();
//critical section
}
finally{
mylock.unlock();
}

Also:
try a lock with a timeout trylock()
wait for some condition: condition.await()
these could come handy to avoid the deadlock situations.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions