public static void exitFrame ( String className ) { int counter = local . get ( ) . decrementAndGet ( ) ; if ( counter < 0 ) { String errorMessage = "Method frame counter is less then 0. Some programming error: count(exitFrame) > count(enterFrame)." + getClassNames ( ) ; clearCounter ( ) ; throw new RuntimeException ( errorMessage ) ; } String frameToExit = classNames . get ( ) . remove ( classNames . get ( ) . size ( ) - 1 ) ; if ( ! className . equals ( frameToExit ) ) { throw new RuntimeException ( "Method frame counter try to exit from the class '" + className + "' but must exit from the class '" + frameToExit + "' first." + getClassNames ( ) ) ; } }
Decrement the counter and remove class name from the list .