Java Code Examples for sun.management.snmp.util.SnmpCachedData#oidComparator()

The following examples show how to use sun.management.snmp.util.SnmpCachedData#oidComparator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JvmThreadInstanceTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 2
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 3
Source File: JvmThreadInstanceTableMetaImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 4
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 5
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 6
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 7
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 8
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 9
Source File: JvmThreadInstanceTableMetaImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 10
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 11
Source File: JvmThreadInstanceTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 12
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 13
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 14
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 15
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 16
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 17
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 18
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}
 
Example 19
Source File: JvmThreadInstanceTableMetaImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler containing the Thread indexes.
 * Indexes are computed from the ThreadId.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {

    // We are getting all the thread ids. WARNING.
    // Some of them will be not valid when accessed for data...
    // See getEntry
    long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();


    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    SnmpOid indexes[] = new SnmpOid[id.length];
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    for(int i = 0; i < id.length; i++) {
        log.debug("", "Making index for thread id [" + id[i] +"]");
        //indexes[i] = makeOid(id[i]);
        SnmpOid oid = makeOid(id[i]);
        table.put(oid, oid);
    }

    return new SnmpCachedData(time, table);
}
 
Example 20
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a table handler that holds the jvmMemManagerTable table data.
 * This method return the cached table data if it is still
 * valid, recompute it and cache the new value if it's not.
 * If it needs to recompute the cached data, it first
 * try to obtain the list of memory managers from the request
 * contextual cache, and if it is not found, it calls
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * and caches the value.
 * This ensures that
 * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
 * is not called more than once per request, thus ensuring a
 * consistent view of the table.
 **/
protected SnmpCachedData updateCachedDatas(Object userData) {
    // Get the MemoryManager     table
    final SnmpTableHandler mmHandler =
        meta.getManagerHandler(userData);

    // Get the MemoryPool        table
    final SnmpTableHandler mpHandler =
        meta.getPoolHandler(userData);

    // Time stamp for the cache
    final long time = System.currentTimeMillis();

    //     Build a Map poolname -> index
    final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);

    // For each memory manager, get the list of memory pools
    // For each memory pool, find its index in the memory pool table
    // Create a row in the relation table.
    final TreeMap<SnmpOid, Object> table =
            new TreeMap<>(SnmpCachedData.oidComparator);
    updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);

    return new SnmpCachedData(time,table);
}