public class LeftRightDeadLock
{
private final Object left = new Object();
private final Object right = new Object();
public void leftRight()
{
synchronized (left)
{
synchronized (right)
{
//doSomthing();
}
}
}
public void rightLeft()
{
synchronized (right)
{
synchronized (left)
{
//doSomething();
}
}
}
}