public Object getLock(Object key)
    {
        int index = (key.hashCode() & 0x7FFFFFFF) % locks.length;

        // Double-checked locking.  Safe since Object has no state.
        Object lock = locks[index];
        if (lock == null)
        {
            synchronized (this)
            {
                lock = locks[index];
                if (lock == null)
                {
                    lock = new Object();
                    locks[index] = lock;
                }
            }
        }

        return lock;
    }
public Object getLock ( Object key ) { int index = ( key . hashCode ( ) & 0x7FFFFFFF ) % locks . length ; Object lock = locks [ index ] ; if ( lock == null ) { synchronized ( this ) { lock = locks [ index ] ; if ( lock == null ) { lock = new Object ( ) ; locks [ index ] = lock ; } } } return lock ; }
Return the lock which is associated with the specified key. Uses
<code>hashCode()</code> to index into the table of locks. Keys
which hash identically will share a single lock.
<p>

@param key The key for which the lock is desired