There are branches of code that will never allow the unlock to be invoked. For instance in add
if(head.next==null){
head.addNext(new Node(o,null));
return true;
}
You return without unlocking. You should follow the lock try finally unlock
semantics.
lock.lock();
try{
... do stuff
return true;
}finally{
lock.unlock();
}