@ Weight ( value = Weight . Unit . VARIABLE , comment = "Depends on the current call stack depth" ) public static void processDeferredActions ( ) { final int stackDepth = ThreadUtils . stackDepth ( ) ; final List < Deferred > list = REGISTRY . get ( ) ; final Iterator < Deferred > iterator = list . iterator ( ) ; while ( iterator . hasNext ( ) ) { final Deferred deferred = iterator . next ( ) ; if ( deferred . getStackDepth ( ) >= stackDepth ) { try { deferred . executeDeferred ( ) ; } catch ( Exception ex ) { final UnexpectedProcessingError error = new UnexpectedProcessingError ( "Error during deferred action processing" , ex ) ; MetaErrorListeners . fireError ( error . getMessage ( ) , error ) ; } finally { iterator . remove ( ) ; } } } if ( list . isEmpty ( ) ) { REGISTRY . remove ( ) ; } }
Process all defer actions for the current stack depth level .