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;
}
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;
}
Aggregations