• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SnmpTableHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sun.management.snmp.util.SnmpTableHandler的典型用法代码示例。如果您正苦于以下问题:Java SnmpTableHandler类的具体用法?Java SnmpTableHandler怎么用?Java SnmpTableHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SnmpTableHandler类属于sun.management.snmp.util包,在下文中一共展示了SnmpTableHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getNext

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
/**
 * Returns the index that immediately follows the given
 * <var>index</var>. The returned index is strictly greater
 * than the given <var>index</var>, and is contained in the table.
 * <br>If the given <var>index</var> is null, returns the first
 * index in the table.
 * <br>If there are no index after the given <var>index</var>,
 * returns null.
 **/
public SnmpOid getNext(SnmpTableHandler handler, SnmpOid index) {

    // try to call the optimized method
    if (handler instanceof SnmpCachedData)
        return getNext((SnmpCachedData)handler, index);

    // too bad - revert to non-optimized generic algorithm
    SnmpOid next = index;
    do {
        next = handler.getNext(next);
        final Object value = handler.getData(next);
        if (value instanceof GarbageCollectorMXBean)
            // That's the next! return it
            return next;
        // skip to next index...
    } while (next != null);
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:JvmMemGCTableMetaImpl.java


示例2: findInCache

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
/**
 * WARNING: This should probably be moved to JvmMemPoolTableMetaImpl
 **/
private int findInCache(SnmpTableHandler handler,
                        String poolName) {

    if (!(handler instanceof SnmpCachedData)) {
        if (handler != null) {
            final String err = "Bad class for JvmMemPoolTable datas: " +
                handler.getClass().getName();
            log.error("getJvmMemPoolEntry", err);
        }
        return -1;
    }

    final SnmpCachedData data = (SnmpCachedData)handler;
    final int len = data.datas.length;
    for (int i=0; i < data.datas.length ; i++) {
        final MemoryPoolMXBean pool = (MemoryPoolMXBean) data.datas[i];
        if (poolName.equals(pool.getName())) return i;
    }
    return -1;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JVM_MANAGEMENT_MIB_IMPL.java


示例3: contains

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
protected boolean contains(SnmpOid oid, Object userData) {

        // Get the handler.
        //
        SnmpTableHandler handler = getHandler(userData);

        // handler should never be null.
        //
        if (handler == null)
            return false;
        if(!handler.contains(oid))
            return false;

        JvmThreadInstanceEntryImpl inst = getJvmThreadInstance(userData, oid);
        return (inst != null);
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:JvmThreadInstanceTableMetaImpl.java


示例4: buildPoolIndexMap

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
/**
 * Builds a map pool-name => pool-index from the SnmpTableHandler
 * of the JvmMemPoolTable.
 **/
private static Map<String, SnmpOid> buildPoolIndexMap(SnmpTableHandler handler) {
    // optimization...
    if (handler instanceof SnmpCachedData)
        return buildPoolIndexMap((SnmpCachedData)handler);

    // not optimizable... too bad.
    final Map<String, SnmpOid> m = new HashMap<>();
    SnmpOid index=null;
    while ((index = handler.getNext(index))!=null) {
        final MemoryPoolMXBean mpm =
            (MemoryPoolMXBean)handler.getData(index);
        if (mpm == null) continue;
        final String name = mpm.getName();
        if (name == null) continue;
        m.put(name,index);
    }
    return m;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:JvmMemMgrPoolRelTableMetaImpl.java


示例5: updateCachedDatas

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:JvmMemMgrPoolRelTableMetaImpl.java


示例6: updateTreeMap

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:JvmMemMgrPoolRelTableMetaImpl.java


示例7: buildPoolIndexMap

import sun.management.snmp.util.SnmpTableHandler; //导入依赖的package包/类
/**
 * Builds a map pool-name => pool-index from the SnmpTableHandler
 * of the JvmMemPoolTable.
 **/
private static Map<String, SnmpOid> buildPoolIndexMap(SnmpTableHandler handler) {
    // optimization...
    if (handler instanceof SnmpCachedData)
        return buildPoolIndexMap((SnmpCachedData)handler);

    // not optimizable... too bad.
    final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>();
    SnmpOid index=null;
    while ((index = handler.getNext(index))!=null) {
        final MemoryPoolMXBean mpm =
            (MemoryPoolMXBean)handler.getData(index);
        if (mpm == null) continue;
        final String name = mpm.getName();
        if (name == null) continue;
        m.put(name,index);
    }
    return m;
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:23,代码来源:JvmMemMgrPoolRelTableMetaImpl.java



注:本文中的sun.management.snmp.util.SnmpTableHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RepositoryPolicy类代码示例发布时间:2022-05-22
下一篇:
Java IIOPAddress类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap