public User resolveUser ( final String username ) throws SQLException { metrics . usernameCacheTries . mark ( ) ; User user = usernameCache . getIfPresent ( username ) ; if ( user != null ) { metrics . usernameCacheHits . mark ( ) ; return user ; } else { user = selectUser ( username ) ; if ( user != null ) { usernameCache . put ( username , user ) ; } return user ; } }
Resolves a user by username possibly with the internal cache .