java.lang.Object | |||
↳ | sun.management.snmp.util.SnmpTableCache | ||
↳ | sun.management.snmp.util.SnmpListTableCache | ||
↳ | sun.management.snmp.util.SnmpNamedListTableCache |
This abstract class implements a weak cache that holds table data, for a table whose data is obtained from a list where a name can be obtained for each item in the list.
This object maintains a map between an entry name and its associated SnmpOid index, so that a given entry is always associated to the same index.
NOTE: This class is not synchronized, subclasses must implement the appropriate synchronization whwn needed.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
last | The last allocate index. | ||||||||||
names | This map associate an entry name with the SnmpOid index that's been allocated for it. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Call
getKey(Object, List, int, Object) in order to get
the item name. | |||||||||||
Returns the key to use as name for the given item.
| |||||||||||
Get a list of raw data from which to build the cached data.
| |||||||||||
The name under which the raw data is to be found/put in
the request contextual cache.
| |||||||||||
Load a list of raw data from which to build the cached data.
| |||||||||||
Find a new index for the entry corresponding to the
given item.
| |||||||||||
Update cahed datas.
| |||||||||||
Allocate a new
TreeMap to serve as context, then
call updateCachedDatas(Object, List) , and
finally replace the names TreeMap by the new allocated
TreeMap. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
The last allocate index.
This map associate an entry name with the SnmpOid index that's been allocated for it.
Call getKey(Object, List, int, Object)
in order to get
the item name. Then check whether an index was already allocated
for the entry by that name. If yes return it. Otherwise, call
makeIndex(Object, List, int, Object)
to compute a new
index for that entry.
Finally store the association between
the name and index in the context TreeMap.
context | The context passed to
updateCachedDatas(Object, List) .
It is expected to
be an instance of TreeMap . |
---|---|
rawDatas | Raw table datas passed to
updateCachedDatas(Object, List) . |
rank | Rank of the given item in the rawDatas list iterator. |
item | The raw data object for which an index must be determined. |
Returns the key to use as name for the given item.
This method is called by getIndex(Object, List, int, Object)
.
The given item is expected to be always associated with
the same name.
context | The context passed to
updateCachedDatas(Object, List) . |
---|---|
rawDatas | Raw table datas passed to
updateCachedDatas(Object, List) . |
rank | Rank of the given item in the rawDatas list iterator. |
item | The raw data object for which a key name must be determined. |
Get a list of raw data from which to build the cached data.
Obtains a list of raw data by first looking it up in the
request contextual cache userData under the given
key. If nothing is found in the cache, calls
loadRawDatas(Map)
to obtain a new rawData list,
and cache the result in userData under key.
userData | The request contextual cache allocated by
the JvmContextFactory . |
---|---|
key | The name under which the raw data is to be found/put in the request contextual cache. |
The name under which the raw data is to be found/put in the request contextual cache.
Load a list of raw data from which to build the cached data. This method is called when nothing is found in the request contextual cache.
userData | The request contextual cache allocated by
the JvmContextFactory .
|
---|
Find a new index for the entry corresponding to the
given item.
This method is called by getIndex(Object, List, int, Object)
when a new index needs to be allocated for an item. The
index returned must not be already in used.
context | The context passed to
updateCachedDatas(Object, List) . |
---|---|
rawDatas | Raw table datas passed to
updateCachedDatas(Object, List) . |
rank | Rank of the given item in the rawDatas list iterator. |
item | The raw data object for which an index must be determined. |
Update cahed datas.
Obtains a List
of raw datas by calling
getRawDatas((Map)context,getRawDatasKey())
.
Then allocate a new TreeMap
to serve as temporary map between
names and indexes, and call updateCachedDatas(Object, List)
with that temporary map as context.
Finally replaces the names
TreeMap by the temporary
TreeMap.
context | The request contextual cache allocated by the
JvmContextFactory .
|
---|
Allocate a new TreeMap
to serve as context, then
call updateCachedDatas(Object, List)
, and
finally replace the names
TreeMap by the new allocated
TreeMap.
context | A context object, valid during the duration of
of the call to this method, and that will be passed to
getIndex(Object, List, int, Object) and getData(Object, List, int, Object) . This method is intended to be called by updateCachedDatas(Object) . It is assumed that
the context is be allocated by before this method is called,
and released just after this method has returned.This class does not use the context object: it is a simple hook for subclassed. |
---|---|
rawDatas | The table datas from which the cached data will be computed. |