Search in sources :

Example 26 with SnmpTableHandler

use of sun.management.snmp.util.SnmpTableHandler in project jdk8u_jdk by JetBrains.

the class JvmThreadInstanceTableMetaImpl method getEntry.

// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid) throws SnmpStatusException {
    log.debug("*** **** **** **** getEntry", "oid [" + oid + "]");
    if (oid == null || oid.getLength() != 8) {
        log.debug("getEntry", "Invalid oid [" + oid + "]");
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    }
    // Get the request contextual cache (userData).
    //
    final Map<Object, Object> m = JvmContextFactory.getUserData();
    // Get the handler.
    //
    SnmpTableHandler handler = getHandler(m);
    //
    if (handler == null || !handler.contains(oid))
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    final JvmThreadInstanceEntryImpl entry = getJvmThreadInstance(m, oid);
    if (entry == null)
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    return entry;
}
Also used : SnmpStatusException(com.sun.jmx.snmp.SnmpStatusException) SnmpTableHandler(sun.management.snmp.util.SnmpTableHandler)

Example 27 with SnmpTableHandler

use of sun.management.snmp.util.SnmpTableHandler in project jdk8u_jdk by JetBrains.

the class JvmThreadInstanceTableMetaImpl method getHandler.

/**
     * Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
     * First look it up in the request contextual cache, and if it is
     * not found, obtain it from the weak cache.
     * <br>The request contextual cache will be released at the end of the
     * current requests, and is used only to process this request.
     * <br>The weak cache is shared by all requests, and is only
     * recomputed when it is found to be obsolete.
     * <br>Note that the data put in the request contextual cache is
     *     never considered to be obsolete, in order to preserve data
     *     coherency.
     **/
protected SnmpTableHandler getHandler(Object userData) {
    final Map<Object, Object> m;
    if (userData instanceof Map)
        m = Util.cast(userData);
    else
        m = null;
    // Look in the contextual cache.
    if (m != null) {
        final SnmpTableHandler handler = (SnmpTableHandler) m.get("JvmThreadInstanceTable.handler");
        if (handler != null)
            return handler;
    }
    // No handler in contextual cache, make a new one.
    final SnmpTableHandler handler = cache.getTableHandler();
    if (m != null && handler != null)
        m.put("JvmThreadInstanceTable.handler", handler);
    return handler;
}
Also used : SnmpTableHandler(sun.management.snmp.util.SnmpTableHandler) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

SnmpTableHandler (sun.management.snmp.util.SnmpTableHandler)27 SnmpStatusException (com.sun.jmx.snmp.SnmpStatusException)18 SnmpOid (com.sun.jmx.snmp.SnmpOid)9 Map (java.util.Map)8 SnmpString (com.sun.jmx.snmp.SnmpString)4 TreeMap (java.util.TreeMap)4 HashMap (java.util.HashMap)1