public boolean contains(JwtToken token) {
        if (token == null) {
            return false;
        }
        Claims claims = token.getClaims();
        if (claims == null) {
            return false;
        }
        String key = claims.getJwtId();
        if (key == null) {
            return false;
        }
        key = getCacheKey(token);
        long currentTimeMilliseconds = (new Date()).getTime();
        synchronized (primaryTable) {
            Long exp = (Long) primaryTable.get(key); // milliseconds
            if (exp != null) {
                if (exp.longValue() > currentTimeMilliseconds) { // not expired yet // milliseconds
                    return true;
                } else {
                    primaryTable.remove(key);
                }
            }
            // cache the jwt
            long tokenExp = claims.getExpiration() * 1000; // milliseconds
            if (tokenExp == 0) { // in case it's not set, let's give it one hour
                tokenExp = currentTimeMilliseconds + 60 * 60 * 1000; // 1 hour
            }
            primaryTable.put(key, Long.valueOf(tokenExp));
        }

        return false;
    }
public boolean contains ( JwtToken token ) { if ( token == null ) { return false ; } Claims claims = token . getClaims ( ) ; if ( claims == null ) { return false ; } String key = claims . getJwtId ( ) ; if ( key == null ) { return false ; } key = getCacheKey ( token ) ; long currentTimeMilliseconds = ( new Date ( ) ) . getTime ( ) ; synchronized ( primaryTable ) { Long exp = ( Long ) primaryTable . get ( key ) ; if ( exp != null ) { if ( exp . longValue ( ) > currentTimeMilliseconds ) { return true ; } else { primaryTable . remove ( key ) ; } } long tokenExp = claims . getExpiration ( ) * 1000 ; if ( tokenExp == 0 ) { tokenExp = currentTimeMilliseconds + 60 * 60 * 1000 ; } primaryTable . put ( key , Long . valueOf ( tokenExp ) ) ; } return false ; }
Find and return the object associated with the specified key.