本文整理汇总了Java中sun.management.snmp.util.SnmpCachedData.find方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpCachedData.find方法的具体用法?Java SnmpCachedData.find怎么用?Java SnmpCachedData.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.management.snmp.util.SnmpCachedData
的用法示例。
在下文中一共展示了SnmpCachedData.find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNext
import sun.management.snmp.util.SnmpCachedData; //导入方法依赖的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.
* This method is an optimization for the case where the
* SnmpTableHandler is in fact an instance of SnmpCachedData.
**/
public SnmpOid getNext(SnmpCachedData datas, SnmpOid index) {
final boolean dbg = log.isDebugOn();
// We're going to loop until we find an instance of
// GarbageCollectorMXBean. First we attempt to find
// the next element whose OID follows the given index.
// If `index' is null, the insertion point is -1
// (the next is 0 = -insertion - 1)
//
final int insertion = (index==null)?-1:datas.find(index);
if (dbg) log.debug("GCTableFilter","oid="+index+
" at insertion="+insertion);
int next;
if (insertion > -1) next = insertion+1;
else next = -insertion -1;
// Now `next' points to the element that imediately
// follows the given `index'. We're going to loop
// through the table, starting at `next' (included),
// and return the first element which is an instance
// of GarbageCollectorMXBean.
//
for (;next<datas.indexes.length;next++) {
if (dbg) log.debug("GCTableFilter","next="+next);
final Object value = datas.datas[next];
if (dbg) log.debug("GCTableFilter","value["+next+"]=" +
((MemoryManagerMXBean)value).getName());
if (value instanceof GarbageCollectorMXBean) {
// That's the next: return it.
if (dbg) log.debug("GCTableFilter",
((MemoryManagerMXBean)value).getName() +
" is a GarbageCollectorMXBean.");
return datas.indexes[next];
}
if (dbg) log.debug("GCTableFilter",
((MemoryManagerMXBean)value).getName() +
" is not a GarbageCollectorMXBean: " +
value.getClass().getName());
// skip to next index...
}
return null;
}