/** * Creates the cache to be used for storing string registries. This method can be overriden * to use a particular cache implementation. * * @param expirationDuration * The duration until a cache entry expires * @param expirationTimeUnit * The time unit for the cache expiration * @return An appropriate cache instance */ protected StringRegistryCache createCache(final long expirationDuration, final TimeUnit expirationTimeUnit) { return new StringRegistryCache(expirationDuration, expirationTimeUnit); }
/** * Creates a new registry cache using the given cache duration configuration. * * @param expirationDuration * The duration until a registry is evicted * @param expirationTimeUnit * The time unit for the expiration duration */ public StringRegistryCache(final long expirationDuration, final TimeUnit expirationTimeUnit) { this.cache = this.createCache(expirationDuration, expirationTimeUnit); }
private ILookup<String> getStringRegistry(final long registryId) { return this.stringRegistryCache.getOrCreateRegistry(registryId); }
/** * Creates the cache to be used for storing string registries. This method can be overriden * to use a particular cache implementation. * * @param expirationDuration * The duration until a cache entry expires * @param expirationTimeUnit * The time unit for the cache expiration * @return An appropriate cache instance */ protected StringRegistryCache createCache(final long expirationDuration, final TimeUnit expirationTimeUnit) { return new StringRegistryCache(expirationDuration, expirationTimeUnit); }
private ILookup<String> getStringRegistry(final long registryId) { return this.stringRegistryCache.getOrCreateRegistry(registryId); }
/** * Creates a new registry cache using the given cache duration configuration. * * @param expirationDuration * The duration until a registry is evicted * @param expirationTimeUnit * The time unit for the expiration duration */ public StringRegistryCache(final long expirationDuration, final TimeUnit expirationTimeUnit) { this.cache = this.createCache(expirationDuration, expirationTimeUnit); }
/** * Constructor which allows to specify a configuration property which contains the cache duration in the * given time unit. Since defaults are populated by the super constructor, the access to the configuration * property needs to be deferred until after the super constructor invocation. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. The component will be registered. * @param cacheDurationProperty * The name of the configuration property containing the cache duration * @param cacheDurationTimeUnit * The time unit for the cache duration */ protected AbstractStringRegistryReaderPlugin(final Configuration configuration, final IProjectContext projectContext, final String cacheDurationProperty, final TimeUnit cacheDurationTimeUnit) { super(configuration, projectContext); // Since the defaults are populated by the super constructor, the property access // must be performed after the super call final long cacheExpirationDuration = configuration.getLongProperty(cacheDurationProperty); this.stringRegistryLookup = new StringRegistryCache(cacheExpirationDuration, cacheDurationTimeUnit); }
private ReaderRegistry<String> getStringRegistry(final long registryId) { return this.stringRegistryCache.getOrCreateRegistry(registryId); }
/** * Constructor which allows to specify a configuration property which contains the cache duration in the * given time unit. Since defaults are populated by the super constructor, the access to the configuration * property needs to be deferred until after the super constructor invocation. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. The component will be registered. * @param cacheDurationProperty * The name of the configuration property containing the cache duration * @param cacheDurationTimeUnit * The time unit for the cache duration */ protected AbstractStringRegistryReaderPlugin(final Configuration configuration, final IProjectContext projectContext, final String cacheDurationProperty, final TimeUnit cacheDurationTimeUnit) { super(configuration, projectContext); // Since the defaults are populated by the super constructor, the property access // must be performed after the super call final long cacheExpirationDuration = configuration.getLongProperty(cacheDurationProperty); this.stringRegistryLookup = new StringRegistryCache(cacheExpirationDuration, cacheDurationTimeUnit); }
private ReaderRegistry<String> getStringRegistry(final long registryId) { return this.stringRegistryCache.getOrCreateRegistry(registryId); }