public void acquireLock ( final NodeObject . Lock lock , final ResultListener < String > listener ) { // wait until any pending resolution is complete queryLock ( lock , new ChainedResultListener < String , String > ( listener ) { public void requestCompleted ( String result ) { if ( result == null ) { if ( _suboids . isEmpty ( ) ) { lockAcquired ( lock , 0L , listener ) ; } else { _locks . put ( lock , new LockHandler ( lock , true , listener ) ) ; } } else { listener . requestCompleted ( result ) ; } } } ) ; }
Acquires a lock on a resource shared amongst this node s peers . If the lock is successfully acquired the supplied listener will receive this node s name . If another node acquires the lock first then the listener will receive the name of that node .