Class ReuseSingletonStrategy<T extends FeatureInput>
Object
org.anchoranalysis.feature.session.replace.ReuseSingletonStrategy<T>
- Type Parameters:
T- feature input-type
- All Implemented Interfaces:
ReplaceStrategy<T>
public class ReuseSingletonStrategy<T extends FeatureInput> extends Object implements ReplaceStrategy<T>
Always re-use an existing
SessionInputSequential, invalidating it each time a new call
occurs.-
Constructor Summary
Constructors Constructor Description ReuseSingletonStrategy(CacheCreator cacheCreator)Constructor with default means of creating aFeatureCalculationInput.ReuseSingletonStrategy(CacheCreator cacheCreator, ChildCacheFinder findChildStrategy)Constructor with custom means of creating aFeatureCalculationInput -
Method Summary
Modifier and Type Method Description FeatureCalculationInput<T>createOrReuse(T input)Find or create aFeatureCalculationInputto associate withinput.
-
Constructor Details
-
ReuseSingletonStrategy
Constructor with default means of creating aFeatureCalculationInput.- Parameters:
cacheCreator- creates aFeatureCalculationCache.
-
ReuseSingletonStrategy
Constructor with custom means of creating aFeatureCalculationInput- Parameters:
cacheCreator- creates a cache.findChildStrategy- the strategy for finding child-caches.
-
-
Method Details
-
createOrReuse
public FeatureCalculationInput<T> createOrReuse(T input) throws org.anchoranalysis.core.exception.OperationFailedExceptionDescription copied from interface:ReplaceStrategyFind or create aFeatureCalculationInputto associate withinput.- Specified by:
createOrReusein interfaceReplaceStrategy<T extends FeatureInput>- Parameters:
input- the input that aFeatureCalculationInputwill be associated with.- Returns:
- the
FeatureCalculationInput, either newly created, or reused from a previous call. - Throws:
org.anchoranalysis.core.exception.OperationFailedException- if an error-state emerge
-