@Override public void run() { decoratedPS = (PropertySet) args.get("PropertySet"); if (decoratedPS == null) { // we are being constructed without a delegate, die now instead of dying later as per JRA-13778 throw new NullPointerException("Decorated property set is missing! Cannot initialise."); } propertySetCache = new PropertySetCache(); } });
/** * Clears any cached properties. Does not affect the decorated {@link PropertySet}. * * @since 6.1 */ public void clearCache() { if (propertySetCache != null) { propertySetCache.clear(); } }
return propertySetCache.getBoolean(key); return propertySetCache.getBoolean(key); propertySetCache.setBoolean(key, value); return value;
Boolean exists = propertySetCache.exists(key); if (exists != null) exists = propertySetCache.exists(key); if (exists != null) propertySetCache.cacheExistance(key, keyExists); return keyExists;
/** * Eagerly loads all the values from the given PropertySet into this cache. * * @param source The PropertySet to bulk load from. */ public void bulkLoad(final PropertySet source) { for (final Object key : source.getKeys()) { try { cloneProperty((String)key, source); } catch (PropertyException ex) { // JRADEV-22946. We are seeing this error on startup in OnDemand. // Presumably another thread is deleting while we are reading, so the whole idea that we can have a cache // for this property set would seem flawed. Meaning that this really _is_ an error. // However, propagating the RuntimeException just makes it worse (eg it causes plugins to fail to load). // It seems the best thing to do here is to log an error with stacktrace but let the bulk load complete. log.error("Unable to clone property '" + key + "' in PropertySet.", ex); } } }
@Override public void run() { decoratedPS.remove(); propertySetCache.clear(); } });