T
- type of object being stored@ThreadSafe public class IndexingObjectStore<T> extends Object
KeyInfo
s contain keys, certs, and CRLs. Multiple unique instances of
a KeyInfo may contain, and separately construct, the exact same cert. KeyInfo could, therefore, create a class-level
instance of this object store and put certs within it. In this manner the cert is only sitting in memory once and
each KeyInfo simply stores a reference (index) to stored object.
This store uses basic reference counting to keep track of how many of the respective objects are pointing to an
entry. Adding an object that already exists, as determined by the objects hashCode()
method, simply
increments the reference counter. Removing an object decrements the counter. Only when the counter reaches zero is
the object actually freed for garbage collection.
Note the instance of an object returned by get(String)
need not be the same object as
stored via put(Object)
. However, their hash codes will be equal. Therefore this store should never be
used to store objects that produce identical hash codes but are not functionally identical objects.コンストラクタと説明 |
---|
IndexingObjectStore()
Constructor.
|
修飾子とタイプ | メソッドと説明 |
---|---|
void |
clear()
Clears the object store.
|
boolean |
contains(String index)
Checks whether the store contains an object registered under the given index.
|
T |
get(String index)
Gets a registered object by its index.
|
boolean |
isEmpty()
Checks if the store is empty.
|
String |
put(T object)
Adds the given object to the store.
|
void |
remove(String index)
Removes the object associated with the given index.
|
int |
size()
Gets the total number of unique items in the store.
|
public void clear()
public boolean contains(String index)
index
- the index to checkpublic boolean isEmpty()
public String put(T object)
object
- the object to add to the store, may be nullpublic T get(String index)
index
- the index of an object previously registered, may be nullpublic void remove(String index)
index
- the index of the object, may be nullpublic int size()
Copyright © 2012. All Rights Reserved.