void ixLock ( Object obj , long txNum ) { Object anchor = getAnchor ( obj ) ; txWaitMap . put ( txNum , anchor ) ; synchronized ( anchor ) { Lockers lks = prepareLockers ( obj ) ; if ( hasIxLock ( lks , txNum ) ) return ; try { long timestamp = System . currentTimeMillis ( ) ; while ( ! ixLockable ( lks , txNum ) && ! waitingTooLong ( timestamp ) ) { avoidDeadlock ( lks , txNum , IX_LOCK ) ; lks . requestSet . add ( txNum ) ; anchor . wait ( MAX_TIME ) ; lks . requestSet . remove ( txNum ) ; } if ( ! ixLockable ( lks , txNum ) ) throw new LockAbortException ( ) ; lks . ixLockers . add ( txNum ) ; getObjectSet ( txNum ) . add ( obj ) ; } catch ( InterruptedException e ) { throw new LockAbortException ( ) ; } } txWaitMap . remove ( txNum ) ; }
Grants an ixlock on the specified item . If any conflict lock exists when the method is called then the calling thread will be placed on a wait list until the lock is released . If the thread remains on the wait list for a certain amount of time then an exception is thrown .