public synchronized RESPONSE_TYPE getValue ( final RESOURCE_TYPE iResource , final long iTimeout ) { if ( OLogManager . instance ( ) . isDebugEnabled ( ) ) OLogManager . instance ( ) . debug ( this , "Thread [" + Thread . currentThread ( ) . getId ( ) + "] is waiting for the resource " + iResource + ( iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms" ) ) ; synchronized ( iResource ) { try { iResource . wait ( iTimeout ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new OLockException ( "Thread interrupted while waiting for resource '" + iResource + "'" ) ; } } Object [ ] value = queue . remove ( iResource ) ; return ( RESPONSE_TYPE ) ( value != null ? value [ 1 ] : null ) ; }
Wait until the requested resource is unlocked . Put the current thread in sleep until timeout or is waked up by an unlock .