@NotThreadSafe public final class MetaParams extends Object
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
.
Modifier and Type | Class and Description |
---|---|
static class |
MetaParams.Externalizer |
Modifier and Type | Method and Description |
---|---|
void |
add(MetaParam.Writable meta) |
void |
addMany(MetaParam.Writable... metaParams) |
<T> Optional<T> |
find(Class<T> type) |
boolean |
isEmpty() |
int |
size() |
String |
toString() |
public boolean isEmpty()
public int size()
public void add(MetaParam.Writable meta)
public void addMany(MetaParam.Writable... metaParams)
Copyright © 2017 JBoss, a division of Red Hat. All rights reserved.