this.notificationConfig = Configuration.get().notificationConfiguration(); this.expiresMessages = ExpiringMap.builder() .expiration(10, TimeUnit.SECONDS) .build(); this.messageBuilder = new HtmlMessageBuilder(); this.initHeaderBar();
public RedisCacheEnabledInterceptor() { this(Executors.newSingleThreadScheduledExecutor(), ExpiringMap.builder().variableExpiration().<String, CachedValueWrapper>build()); }
/** * Sets the ExpiringEntryLoader to use when loading entries and configures {@link #variableExpiration() variable * expiration}. Either an EntryLoader or ExpiringEntryLoader may be set, not both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #entryLoader(EntryLoader) EntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> expiringEntryLoader( ExpiringEntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); expiringEntryLoader = (ExpiringEntryLoader<K, V>) Assert.notNull(loader, "loader"); variableExpiration(); return (Builder<K1, V1>) this; }
/** * Sets the ExpiringEntryLoader to use when loading entries and configures {@link #variableExpiration() variable * expiration}. Either an EntryLoader or ExpiringEntryLoader may be set, not both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #entryLoader(EntryLoader) EntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> expiringEntryLoader( ExpiringEntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); expiringEntryLoader = (ExpiringEntryLoader<K, V>) Assert.notNull(loader, "loader"); variableExpiration(); return (Builder<K1, V1>) this; }
/** * Sets the EntryLoader to use when loading entries. Either an EntryLoader or ExpiringEntryLoader may be set, not * both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #expiringEntryLoader(ExpiringEntryLoader) ExpiringEntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> entryLoader(EntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); entryLoader = (EntryLoader<K, V>) Assert.notNull(loader, "loader"); return (Builder<K1, V1>) this; }
/** * Sets the EntryLoader to use when loading entries. Either an EntryLoader or ExpiringEntryLoader may be set, not * both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #expiringEntryLoader(ExpiringEntryLoader) ExpiringEntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> entryLoader(EntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); entryLoader = (EntryLoader<K, V>) Assert.notNull(loader, "loader"); return (Builder<K1, V1>) this; }
public InMemoryConcurrentRequestRateLimiter(ConcurrentLimitRule rule) { this.rule = rule; expiringKeyMap = ExpiringMap.builder().expiration(rule.getTimeoutMillis(), MILLISECONDS).expirationPolicy(ACCESSED).build(); }
/** * Sets the EntryLoader to use when loading entries. Either an EntryLoader or ExpiringEntryLoader may be set, not * both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #expiringEntryLoader(ExpiringEntryLoader) ExpiringEntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> entryLoader(EntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); entryLoader = (EntryLoader<K, V>) Assert.notNull(loader, "loader"); return (Builder<K1, V1>) this; }
/** * Sets the ExpiringEntryLoader to use when loading entries and configures {@link #variableExpiration() variable * expiration}. Either an EntryLoader or ExpiringEntryLoader may be set, not both. * * @param loader to set * @throws NullPointerException if {@code loader} is null * @throws IllegalStateException if an {@link #entryLoader(EntryLoader) EntryLoader} is set */ @SuppressWarnings("unchecked") public <K1 extends K, V1 extends V> Builder<K1, V1> expiringEntryLoader( ExpiringEntryLoader<? super K1, ? super V1> loader) { assertNoLoaderSet(); expiringEntryLoader = (ExpiringEntryLoader<K, V>) Assert.notNull(loader, "loader"); variableExpiration(); return (Builder<K1, V1>) this; }
public InMemorySlidingWindowRequestRateLimiter(Set<RequestLimitRule> rules, TimeSupplier timeSupplier) { this(ExpiringMap.builder().variableExpiration().build(), rules, timeSupplier); }
protected void initialize() throws PerunException { // gets session for a system principal "perunRegistrar" final PerunPrincipal pp = new PerunPrincipal("perunRegistrar", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); registrarSession = perun.getPerunSession(pp, new PerunClient()); // cache expires after 5 minutes from creation requestCache = ExpiringMap.builder().expiration(5, TimeUnit.MINUTES).expirationPolicy(ExpiringMap.ExpirationPolicy.CREATED).build(); }
/** * Creates an ExpiringMap builder. * * @return New ExpiringMap builder */ public static Builder<Object, Object> builder() { return new Builder<Object, Object>(); }
/** * Creates an ExpiringMap builder. * * @return New ExpiringMap builder */ public static Builder<Object, Object> builder() { return new Builder<Object, Object>(); }
public NotificationPreProcessor() { this.currentMessages = new ArrayList<>(); this.expiresMessages = ExpiringMap.builder() .expiration(1, TimeUnit.HOURS) .build(); this.subscribe(); }
public ExpiringMapPolicy(Config config) { policyStats = new PolicyStats("product.ExpiringMap"); ExpiringMapSettings settings = new ExpiringMapSettings(config); cache = ExpiringMap.builder() .expirationPolicy(settings.policy()) .maxSize(settings.maximumSize()) .build(); }
public MemKeyValueStore() { map = ExpiringMap.builder().expiration(Integer.MAX_VALUE, TimeUnit.DAYS).variableExpiration().build(); try { Field field = map.getClass().getDeclaredField("writeLock"); field.setAccessible(true); writeLock = (Lock) field.get(map); } catch (ReflectiveOperationException | SecurityException e) { throw new RuntimeException(e); } }
/** * Creates an ExpiringMap builder. * * @return New ExpiringMap builder */ public static Builder<Object, Object> builder() { return new Builder<Object, Object>(); }
public ExpiringMapPolicy(Config config) { policyStats = new PolicyStats("product.ExpiringMap"); ExpiringMapSettings settings = new ExpiringMapSettings(config); cache = ExpiringMap.builder() .expirationPolicy(settings.policy()) .maxSize(settings.maximumSize()) .build(); }