public Set<PermissionDetails> get(RoleResource roleResource) { try { return super.get(roleResource); } catch (Exception e) { // because the outer class uses this method as Function<RoleResource, Set<PermissionDetails>>, // which can be overridden for testing, it cannot throw checked exceptions. So here we simply // use guava's propagation helper. throw Throwables.propagate(e); } } }
protected AuthCache(String name, Consumer<Integer> setValidityDelegate, Supplier<Integer> getValidityDelegate, Consumer<Integer> setUpdateIntervalDelegate, Supplier<Integer> getUpdateIntervalDelegate, Consumer<Integer> setMaxEntriesDelegate, Supplier<Integer> getMaxEntriesDelegate, Function<K, V> loadFunction, Supplier<Boolean> enableCache) { this.name = name; this.setValidityDelegate = setValidityDelegate; this.getValidityDelegate = getValidityDelegate; this.setUpdateIntervalDelegate = setUpdateIntervalDelegate; this.getUpdateIntervalDelegate = getUpdateIntervalDelegate; this.setMaxEntriesDelegate = setMaxEntriesDelegate; this.getMaxEntriesDelegate = getMaxEntriesDelegate; this.loadFunction = loadFunction; this.enableCache = enableCache; init(); }
public void invalidate() { cache = initCache(null); }
return null; if (getValidity() <= 0) return null; name, getValidity(), getUpdateInterval(), getMaxEntries()); .refreshAfterWrite(getUpdateInterval(), TimeUnit.MILLISECONDS) .expireAfterWrite(getValidity(), TimeUnit.MILLISECONDS) .maximumSize(getMaxEntries()) .build(new CacheLoader<K, V>()
protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
return null; if (getValidity() <= 0) return null; name, getValidity(), getUpdateInterval(), getMaxEntries()); .refreshAfterWrite(getUpdateInterval(), TimeUnit.MILLISECONDS) .expireAfterWrite(getValidity(), TimeUnit.MILLISECONDS) .maximumSize(getMaxEntries()) .build(new CacheLoader<K, V>()
protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
return null; if (getValidity() <= 0) return null; name, getValidity(), getUpdateInterval(), getMaxEntries()); .refreshAfterWrite(getUpdateInterval(), TimeUnit.MILLISECONDS) .expireAfterWrite(getValidity(), TimeUnit.MILLISECONDS) .maximumSize(getMaxEntries()) .build(new CacheLoader<K, V>()
public void invalidate() { cache = initCache(null); }
protected void init() { this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY); this.cache = initCache(null); try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, getObjectName()); } catch (Exception e) { throw new RuntimeException(e); } }
public Set<PermissionDetails> get(RoleResource roleResource) { try { return super.get(roleResource); } catch (Exception e) { // because the outer class uses this method as Function<RoleResource, Set<PermissionDetails>>, // which can be overridden for testing, it cannot throw checked exceptions. So here we simply // use guava's propagation helper. throw Throwables.propagate(e); } } }
protected AuthCache(String name, Consumer<Integer> setValidityDelegate, Supplier<Integer> getValidityDelegate, Consumer<Integer> setUpdateIntervalDelegate, Supplier<Integer> getUpdateIntervalDelegate, Consumer<Integer> setMaxEntriesDelegate, Supplier<Integer> getMaxEntriesDelegate, Function<K, V> loadFunction, Supplier<Boolean> enableCache) { this.name = name; this.setValidityDelegate = setValidityDelegate; this.getValidityDelegate = getValidityDelegate; this.setUpdateIntervalDelegate = setUpdateIntervalDelegate; this.getUpdateIntervalDelegate = getUpdateIntervalDelegate; this.setMaxEntriesDelegate = setMaxEntriesDelegate; this.getMaxEntriesDelegate = getMaxEntriesDelegate; this.loadFunction = loadFunction; this.enableCache = enableCache; init(); }
public void invalidate() { cache = initCache(null); }
public Set<PermissionDetails> get(RoleResource roleResource) { try { return super.get(roleResource); } catch (Exception e) { // because the outer class uses this method as Function<RoleResource, Set<PermissionDetails>>, // which can be overridden for testing, it cannot throw checked exceptions. So here we simply // use guava's propagation helper. throw Throwables.propagate(e); } } }
protected AuthCache(String name, Consumer<Integer> setValidityDelegate, Supplier<Integer> getValidityDelegate, Consumer<Integer> setUpdateIntervalDelegate, Supplier<Integer> getUpdateIntervalDelegate, Consumer<Integer> setMaxEntriesDelegate, Supplier<Integer> getMaxEntriesDelegate, Function<K, V> loadFunction, Supplier<Boolean> enableCache) { this.name = name; this.setValidityDelegate = setValidityDelegate; this.getValidityDelegate = getValidityDelegate; this.setUpdateIntervalDelegate = setUpdateIntervalDelegate; this.getUpdateIntervalDelegate = getUpdateIntervalDelegate; this.setMaxEntriesDelegate = setMaxEntriesDelegate; this.getMaxEntriesDelegate = getMaxEntriesDelegate; this.loadFunction = loadFunction; this.enableCache = enableCache; init(); }
public void setMaxEntries(int maxEntries) { if (Boolean.getBoolean("cassandra.disable_auth_caches_remote_configuration")) throw new UnsupportedOperationException("Remote configuration of auth caches is disabled"); setMaxEntriesDelegate.accept(maxEntries); cache = initCache(cache); }
public void setValidity(int validityPeriod) { if (Boolean.getBoolean("cassandra.disable_auth_caches_remote_configuration")) throw new UnsupportedOperationException("Remote configuration of auth caches is disabled"); setValidityDelegate.accept(validityPeriod); cache = initCache(cache); }
public void setUpdateInterval(int updateInterval) { if (Boolean.getBoolean("cassandra.disable_auth_caches_remote_configuration")) throw new UnsupportedOperationException("Remote configuration of auth caches is disabled"); setUpdateIntervalDelegate.accept(updateInterval); cache = initCache(cache); }
public void setMaxEntries(int maxEntries) { if (Boolean.getBoolean("cassandra.disable_auth_caches_remote_configuration")) throw new UnsupportedOperationException("Remote configuration of auth caches is disabled"); setMaxEntriesDelegate.accept(maxEntries); cache = initCache(cache); }
public void setUpdateInterval(int updateInterval) { if (Boolean.getBoolean("cassandra.disable_auth_caches_remote_configuration")) throw new UnsupportedOperationException("Remote configuration of auth caches is disabled"); setUpdateIntervalDelegate.accept(updateInterval); cache = initCache(cache); }