Class MetaParams

All Implemented Interfaces:

@NotThreadSafe @Experimental public final class MetaParams extends Object implements Iterable<MetaParam<?>>
Represents a MetaParam collection.

In Params, the internal array where each parameter was stored is indexed by an integer. This worked fine because the available parameters are exclusively controlled by the Infinispan. This is not the case with MetaParam instances where users are expected to add their own types. So, for MetaParams, an array is still used but the lookup is done sequentially comparing the type of the MetaParam looked for against the each individual MetaParam instance stored in MetaParams.

Having sequential MetaParam lookups over an array is O(n), but this is not problematic since the number of MetaParam to be stored with each cached entry is expected to be small, less than 10 per MetaParams collection. So, the performance impact is quite small.

Storing MetaParam instances in an array adds the least amount of overhead to keeping a collection of MetaParam in memory along with each cached entry, while retaining flexibility to add or remove MetaParam instances.

This MetaParams collection is not thread safe because it is expected that any updates will be done having acquired write locks on the entire CacheEntry which references the MetaParams collection. Hence, any updates could be done without the need to keep MetaParams concurrently safe. Also, although users can retrieve or update individual MetaParam instances, they cannot act on the globally at the MetaParams level, and hence there is no risk of users misusing MetaParams. This class should not be accessible from user code, therefore it is package-protected.