jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java
changeset 11530 a9d059c15b80
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
11529:e08d565262ce 11530:a9d059c15b80
    59  * This custom implementation show how to implement an SNMP table
    59  * This custom implementation show how to implement an SNMP table
    60  * over a weak cache, recomputing the cahed data when needed.
    60  * over a weak cache, recomputing the cahed data when needed.
    61  */
    61  */
    62 public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
    62 public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
    63 
    63 
       
    64     static final long serialVersionUID = 36176771566817592L;
       
    65 
    64     /**
    66     /**
    65      * A concrete implementation of {@link SnmpNamedListTableCache}, for the
    67      * A concrete implementation of {@link SnmpNamedListTableCache}, for the
    66      * jvmMemManagerTable.
    68      * jvmMemManagerTable.
    67      **/
    69      **/
    68     private static class JvmMemManagerTableCache
    70     private static class JvmMemManagerTableCache
    69         extends SnmpNamedListTableCache {
    71         extends SnmpNamedListTableCache {
       
    72 
       
    73         static final long serialVersionUID = 6564294074653009240L;
       
    74 
    70         /**
    75         /**
    71          * Create a weak cache for the jvmMemManagerTable.
    76          * Create a weak cache for the jvmMemManagerTable.
    72          * @param validity validity of the cached data, in ms.
    77          * @param validity validity of the cached data, in ms.
    73          **/
    78          **/
    74         JvmMemManagerTableCache(long validity) {
    79         JvmMemManagerTableCache(long validity) {
    85          * @param rank The <var>rank</var> of <var>item</var> in the list.
    90          * @param rank The <var>rank</var> of <var>item</var> in the list.
    86          * @param item The <var>rank</var><super>th</super>
    91          * @param item The <var>rank</var><super>th</super>
    87          *        <code>MemoryManagerMXBean</code> in the list.
    92          *        <code>MemoryManagerMXBean</code> in the list.
    88          * @return  <code>((MemoryManagerMXBean)item).getName()</code>
    93          * @return  <code>((MemoryManagerMXBean)item).getName()</code>
    89          **/
    94          **/
    90         protected String getKey(Object context, List rawDatas,
    95         protected String getKey(Object context, List<?> rawDatas,
    91                                 int rank, Object item) {
    96                                 int rank, Object item) {
    92             if (item == null) return null;
    97             if (item == null) return null;
    93             final String name = ((MemoryManagerMXBean)item).getName();
    98             final String name = ((MemoryManagerMXBean)item).getName();
    94             log.debug("getKey", "key=" + name);
    99             log.debug("getKey", "key=" + name);
    95             return name;
   100             return name;
    97 
   102 
    98         /**
   103         /**
    99          * Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
   104          * Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
   100          **/
   105          **/
   101         public SnmpTableHandler getTableHandler() {
   106         public SnmpTableHandler getTableHandler() {
   102             final Map userData = JvmContextFactory.getUserData();
   107             final Map<Object, Object> userData = JvmContextFactory.getUserData();
   103             return getTableDatas(userData);
   108             return getTableDatas(userData);
   104         }
   109         }
   105 
   110 
   106         /**
   111         /**
   107          * Return the key used to cache the raw data of this table.
   112          * Return the key used to cache the raw data of this table.
   112 
   117 
   113         /**
   118         /**
   114          * Call ManagementFactory.getMemoryManagerMXBeans() to
   119          * Call ManagementFactory.getMemoryManagerMXBeans() to
   115          * load the raw data of this table.
   120          * load the raw data of this table.
   116          **/
   121          **/
   117         protected List   loadRawDatas(Map userData) {
   122         protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
   118             return ManagementFactory.getMemoryManagerMXBeans();
   123             return ManagementFactory.getMemoryManagerMXBeans();
   119         }
   124         }
   120 
   125 
   121     }
   126     }
   122 
   127