boolean isChanged(Authentication auth) {
   int key = auth.hashCode();
   Integer state = authState.get(key);
   if (state != null) {
     return state == 1;
   }
   return false;
 }
 synchronized void changed() {
   if (authCacheKeys != null) {
     for (AuthCacheKey authCacheKey : authCacheKeys) {
       Authentication removed = nonUiAuthCache.remove(authCacheKey);
       if (removed != null) {
         Integer key = removed.hashCode();
         log.debug("Removed {}:{} from the non-ui authentication cache", removed.getName(), key);
         authState.put(key, 1);
       }
     }
     authCacheKeys.clear();
   }
   Set<Integer> keys = new HashSet<>(authState.keySet());
   for (Integer key : keys) {
     authState.put(key, 1);
   }
 }
 void loggedIn(Authentication auth) {
   authState.put(auth.hashCode(), 0);
 }
 void loggedOut(Authentication auth) {
   authState.put(auth.hashCode(), 2);
 }
 AuthenticationCache(Authentication first) {
   authState.put(first.hashCode(), 0);
 }