void releaseTransaction ( @ NotNull final Thread thread , final int permits ) { try ( CriticalSection ignored = criticalSection . enter ( ) ) { int currentThreadPermits = getThreadPermits ( thread ) ; if ( permits > currentThreadPermits ) { throw new ExodusException ( "Can't release more permits than it was acquired" ) ; } acquiredPermits -= permits ; currentThreadPermits -= permits ; if ( currentThreadPermits == 0 ) { threadPermits . remove ( thread ) ; } else { threadPermits . put ( thread , currentThreadPermits ) ; } notifyNextWaiters ( ) ; } }
Release transaction that was acquired in a thread with specified permits .