3081N/A * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. 3081N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3081N/A * This code is free software; you can redistribute it and/or modify it 3081N/A * under the terms of the GNU General Public License version 2 only, as 3081N/A * published by the Free Software Foundation. Oracle designates this 3081N/A * particular file as subject to the "Classpath" exception as provided 3081N/A * by Oracle in the LICENSE file that accompanied this code. 3081N/A * This code is distributed in the hope that it will be useful, but WITHOUT 3081N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3081N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3081N/A * version 2 for more details (a copy is included in the LICENSE file that 3081N/A * You should have received a copy of the GNU General Public License version 3081N/A * 2 along with this work; if not, write to the Free Software Foundation, 3081N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3081N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3081N/A * or visit www.oracle.com if you need additional information or have any * The class is used for implementing the "JvmThreadInstanceTable" group. * Maximum depth of the stacktrace that might be returned through * Since we do not export the stack trace through SNMP, we set * MAX_STACK_TRACE_DEPTH=0 so that ThreadMXBean.getThreadInfo(long) does * not compute the stack trace. * Translate from a long to a Oid. Arc follow the long big-endian order. * @param l The long to make the index from x[
1] = (l >>
48) &
0x00FF;
x[
2] = (l >>
40) &
0x0000FF;
x[
3] = (l >>
32) &
0x000000FF;
x[
4] = (l >>
24) &
0x00000000FF;
x[
5] = (l >>
16) &
0x0000000000FF;
x[
6] = (l >>
8) &
0x000000000000FF;
x[
7] = l &
0x00000000000000FF;
* Translate an Oid to a thread id. Arc follow the long big-endian order. * @param oid The oid to make the id from * A concrete implementation of {@link SnmpTableCache}, for the * JvmThreadInstanceTable. * Create a weak cache for the JvmThreadInstanceTable. * @param validity validity of the cached data, in ms. * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>. * Return a table handler containing the Thread indexes. * Indexes are computed from the ThreadId. // We are getting all the thread ids. WARNING. // Some of them will be not valid when accessed for data... // Time stamp for the cache log.
debug(
"",
"Making index for thread id [" +
id[i] +
"]");
//indexes[i] = makeOid(id[i]); // The weak cache for this table. * Constructor for the table. Initialize metadata for * "JvmThreadInstanceTableMeta". * The reference on the MBean server is updated so the entries created * through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK. log.
debug(
"JvmThreadInstanceTableMetaImpl",
"Create Thread meta");
// See com.sun.jmx.snmp.agent.SnmpMibTable log.
debug(
"JvmThreadInstanceTableMetaImpl",
"getNextOid");
// null means get the first OID. // See com.sun.jmx.snmp.agent.SnmpMibTable // This should never happen. // If we get here it's a bug. log.
debug(
"getNextOid",
"handler is null!");
// if next is null: we reached the end of the table. // See com.sun.jmx.snmp.agent.SnmpMibTable // handler should never be null. // See com.sun.jmx.snmp.agent.SnmpMibTable log.
debug(
"*** **** **** **** getEntry",
"oid [" +
oid +
"]");
// Get the request contextual cache (userData). // handler should never be null. * 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 // Look in the contextual cache. // No handler in contextual cache, make a new one. // the request contextual cache. // Revisit: Probably better programming to put all these strings // If the entry is in the cache, simply return it. if (
dbg)
log.
debug(
"*** getJvmThreadInstance",
"Entry [" +
oid +
"] is not in cache");
// Entry not in cache. We will create one if needed. "Failed to get thread info for rowOid: " +
oid);
log.
debug(
"*** getJvmThreadInstance",r);
// No thread by that id => no entry. "No entry by that oid [" +
oid +
"]");
"Entry created for Thread OID [" +
oid +
"]");