/** * Removes the entry with the given key if the entry's expiration time is * less than <code>now</code>. If the entry has a negative expiration time, * the entry is never removed. */ private void removeIfExpired(final Object key, final long now) { final Long expirationTimeObject = expirationMap.get(key); if (isExpired(now, expirationTimeObject)) { remove(key); } }
@Override public CompletableFuture<Void> removeToken(AccessToken accessToken) { Preconditions.checkNotNull(accessToken); synchronized (tokensExpirationDates) { tokensExpirationDates.remove(accessToken); } return CompletableFuture.completedFuture(null); }