Java Code Examples for sun.management.snmp.util.SnmpTableHandler#getData()

The following examples show how to use sun.management.snmp.util.SnmpTableHandler#getData() . 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: JvmMemGCTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: JvmMemGCTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 6
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: JvmMemGCTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 8
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 9
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 10
Source File: JvmMemGCTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example 12
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: JvmMemGCTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the given <var>index</var> is present.
 **/
public boolean contains(SnmpTableHandler handler, SnmpOid index) {
    if (handler.getData(index) instanceof GarbageCollectorMXBean)
        return true;
    // Behaves as if there was nothing at this index...
    //
    return false;
}
 
Example 14
Source File: JvmMemGCTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the data associated with the given index.
 * If the given index is not found, null is returned.
 * Note that returning null does not necessarily means that
 * the index was not found.
 **/
public Object  getData(SnmpTableHandler handler, SnmpOid index) {
    final Object value = handler.getData(index);
    if (value instanceof GarbageCollectorMXBean) return value;
    // Behaves as if there was nothing at this index...
    //
    return null;
}
 
Example 15
Source File: JvmMemGCTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the data associated with the given index.
 * If the given index is not found, null is returned.
 * Note that returning null does not necessarily means that
 * the index was not found.
 **/
public Object  getData(SnmpTableHandler handler, SnmpOid index) {
    final Object value = handler.getData(index);
    if (value instanceof GarbageCollectorMXBean) return value;
    // Behaves as if there was nothing at this index...
    //
    return null;
}
 
Example 16
Source File: JvmMemGCTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the given <var>index</var> is present.
 **/
public boolean contains(SnmpTableHandler handler, SnmpOid index) {
    if (handler.getData(index) instanceof GarbageCollectorMXBean)
        return true;
    // Behaves as if there was nothing at this index...
    //
    return false;
}
 
Example 17
Source File: JvmMemGCTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the data associated with the given index.
 * If the given index is not found, null is returned.
 * Note that returning null does not necessarily means that
 * the index was not found.
 **/
public Object  getData(SnmpTableHandler handler, SnmpOid index) {
    final Object value = handler.getData(index);
    if (value instanceof GarbageCollectorMXBean) return value;
    // Behaves as if there was nothing at this index...
    //
    return null;
}
 
Example 18
Source File: JvmMemGCTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the given <var>index</var> is present.
 **/
public boolean contains(SnmpTableHandler handler, SnmpOid index) {
    if (handler.getData(index) instanceof GarbageCollectorMXBean)
        return true;
    // Behaves as if there was nothing at this index...
    //
    return false;
}
 
Example 19
Source File: JvmMemGCTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the given <var>index</var> is present.
 **/
public boolean contains(SnmpTableHandler handler, SnmpOid index) {
    if (handler.getData(index) instanceof GarbageCollectorMXBean)
        return true;
    // Behaves as if there was nothing at this index...
    //
    return false;
}
 
Example 20
Source File: JvmMemGCTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the data associated with the given index.
 * If the given index is not found, null is returned.
 * Note that returning null does not necessarily means that
 * the index was not found.
 **/
public Object  getData(SnmpTableHandler handler, SnmpOid index) {
    final Object value = handler.getData(index);
    if (value instanceof GarbageCollectorMXBean) return value;
    // Behaves as if there was nothing at this index...
    //
    return null;
}