public void end(){
  if (cleanupCounter.get() == null || cleanupCounter.get() < 0) {
    log.warn("Cleanup counter is null or invalid");
  }
 else   if (cleanupCounter.get() == 0) {
    log.trace("Cleanup SecurityContext");
    AppContext.setSecurityContext(null);
    cleanupCounter.remove();
  }
 else {
    log.trace("Do not own authentication, cleanup not required");
    cleanupCounter.set(cleanupCounter.get() - 1);
    log.trace("New cleanup counter value: {}",cleanupCounter.get());
  }
}

public void end ( ) { if ( cleanupCounter . get ( ) == null || cleanupCounter . get ( ) < 0 ) { log . warn ( "Cleanup counter is null or invalid" ) ; } else if ( cleanupCounter . get ( ) == 0 ) { log . trace ( "Cleanup SecurityContext" ) ; AppContext . setSecurityContext ( null ) ; cleanupCounter . remove ( ) ; } else { log . trace ( "Do not own authentication, cleanup not required" ) ; cleanupCounter . set ( cleanupCounter . get ( ) - 1 ) ; log . trace ( "New cleanup counter value: {}" , cleanupCounter . get ( ) ) ; } }
end of an authenticated code block . < p / > performs cleanup for securitycontext if there was previous loginonce in this thread . must be called in " finally " section of a try / finally block .
