jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceTableMetaImpl.java
changeset 11530 a9d059c15b80
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
11529:e08d565262ce 11530:a9d059c15b80
    76  * The class is used for implementing the "JvmThreadInstanceTable" group.
    76  * The class is used for implementing the "JvmThreadInstanceTable" group.
    77  */
    77  */
    78 public class JvmThreadInstanceTableMetaImpl
    78 public class JvmThreadInstanceTableMetaImpl
    79     extends JvmThreadInstanceTableMeta {
    79     extends JvmThreadInstanceTableMeta {
    80 
    80 
       
    81     static final long serialVersionUID = -8432271929226397492L;
       
    82 
    81     /**
    83     /**
    82      * Maximum depth of the stacktrace that might be returned through
    84      * Maximum depth of the stacktrace that might be returned through
    83      * SNMP.
    85      * SNMP.
    84      *
    86      *
    85      * Since we do not export the stack trace through SNMP, we set
    87      * Since we do not export the stack trace through SNMP, we set
   133      * JvmThreadInstanceTable.
   135      * JvmThreadInstanceTable.
   134      **/
   136      **/
   135     private static class JvmThreadInstanceTableCache
   137     private static class JvmThreadInstanceTableCache
   136         extends SnmpTableCache {
   138         extends SnmpTableCache {
   137 
   139 
       
   140         static final long serialVersionUID = 4947330124563406878L;
   138         final private JvmThreadInstanceTableMetaImpl meta;
   141         final private JvmThreadInstanceTableMetaImpl meta;
   139 
   142 
   140         /**
   143         /**
   141          * Create a weak cache for the JvmThreadInstanceTable.
   144          * Create a weak cache for the JvmThreadInstanceTable.
   142          * @param validity validity of the cached data, in ms.
   145          * @param validity validity of the cached data, in ms.
   149 
   152 
   150         /**
   153         /**
   151          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
   154          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
   152          **/
   155          **/
   153         public SnmpTableHandler getTableHandler() {
   156         public SnmpTableHandler getTableHandler() {
   154             final Map userData = JvmContextFactory.getUserData();
   157             final Map<Object, Object> userData = JvmContextFactory.getUserData();
   155             return getTableDatas(userData);
   158             return getTableDatas(userData);
   156         }
   159         }
   157 
   160 
   158         /**
   161         /**
   159          * Return a table handler containing the Thread indexes.
   162          * Return a table handler containing the Thread indexes.
   170             // Time stamp for the cache
   173             // Time stamp for the cache
   171             final long time = System.currentTimeMillis();
   174             final long time = System.currentTimeMillis();
   172 
   175 
   173             SnmpOid indexes[] = new SnmpOid[id.length];
   176             SnmpOid indexes[] = new SnmpOid[id.length];
   174             final TreeMap<SnmpOid, Object> table =
   177             final TreeMap<SnmpOid, Object> table =
   175                     new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
   178                     new TreeMap<>(SnmpCachedData.oidComparator);
   176             for(int i = 0; i < id.length; i++) {
   179             for(int i = 0; i < id.length; i++) {
   177                 log.debug("", "Making index for thread id [" + id[i] +"]");
   180                 log.debug("", "Making index for thread id [" + id[i] +"]");
   178                 //indexes[i] = makeOid(id[i]);
   181                 //indexes[i] = makeOid(id[i]);
   179                 SnmpOid oid = makeOid(id[i]);
   182                 SnmpOid oid = makeOid(id[i]);
   180                 table.put(oid, oid);
   183                 table.put(oid, oid);
   275             throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
   278             throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
   276         }
   279         }
   277 
   280 
   278         // Get the request contextual cache (userData).
   281         // Get the request contextual cache (userData).
   279         //
   282         //
   280         final Map m = JvmContextFactory.getUserData();
   283         final Map<Object,Object> m = JvmContextFactory.getUserData();
   281 
   284 
   282         // Get the handler.
   285         // Get the handler.
   283         //
   286         //
   284         SnmpTableHandler handler = getHandler(m);
   287         SnmpTableHandler handler = getHandler(m);
   285 
   288