public final void release ( ) { synchronized ( this . LOCK ) { if ( ( this . owner != null ) && ( this . owner . get ( ) == Thread . currentThread ( ) ) ) { this . acquire -- ; if ( this . acquire == 0 ) { this . owner = null ; this . LOCK . notify ( ) ; } return ; } if ( ( this . owner != null ) && ( this . owner . get ( ) == null ) ) { this . owner = null ; this . acquire = 0 ; this . LOCK . notify ( ) ; } throw new IllegalMonitorStateException ( Thread . currentThread ( ) . getName ( ) + " is not the owner of the lock. " + ( ( this . owner != null ) ? ( ( Thread ) this . owner . get ( ) ) . getName ( ) : "nobody" ) + " is the owner." ) ; } }
Releases the mutex