sun.management.snmp.util.SnmpTableHandler Java Examples
The following examples show how to use
sun.management.snmp.util.SnmpTableHandler.
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: JvmThreadInstanceTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; if(!handler.contains(oid)) return false; JvmThreadInstanceEntryImpl inst = getJvmThreadInstance(userData, oid); return (inst != null); }
Example #2
Source File: JVM_MANAGEMENT_MIB_IMPL.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * WARNING: This should probably be moved to JvmMemPoolTableMetaImpl **/ private int findInCache(SnmpTableHandler handler, String poolName) { if (!(handler instanceof SnmpCachedData)) { if (handler != null) { final String err = "Bad class for JvmMemPoolTable datas: " + handler.getClass().getName(); log.error("getJvmMemPoolEntry", err); } return -1; } final SnmpCachedData data = (SnmpCachedData)handler; final int len = data.datas.length; for (int i=0; i < data.datas.length ; i++) { final MemoryPoolMXBean pool = (MemoryPoolMXBean) data.datas[i]; if (poolName.equals(pool.getName())) return i; } return -1; }
Example #3
Source File: JvmMemGCTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 #4
Source File: JvmMemMgrPoolRelTableMetaImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Return a table handler that holds the jvmMemManagerTable table data. * This method return the cached table data if it is still * valid, recompute it and cache the new value if it's not. * If it needs to recompute the cached data, it first * try to obtain the list of memory managers from the request * contextual cache, and if it is not found, it calls * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code> * and caches the value. * This ensures that * <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code> * is not called more than once per request, thus ensuring a * consistent view of the table. **/ protected SnmpCachedData updateCachedDatas(Object userData) { // Get the MemoryManager table final SnmpTableHandler mmHandler = meta.getManagerHandler(userData); // Get the MemoryPool table final SnmpTableHandler mpHandler = meta.getPoolHandler(userData); // Time stamp for the cache final long time = System.currentTimeMillis(); // Build a Map poolname -> index final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler); // For each memory manager, get the list of memory pools // For each memory pool, find its index in the memory pool table // Create a row in the relation table. final TreeMap<SnmpOid, Object> table = new TreeMap<>(SnmpCachedData.oidComparator); updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap); return new SnmpCachedData(time,table); }
Example #5
Source File: JvmThreadInstanceTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; if(!handler.contains(oid)) return false; JvmThreadInstanceEntryImpl inst = getJvmThreadInstance(userData, oid); return (inst != null); }
Example #6
Source File: JvmThreadInstanceTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; if(!handler.contains(oid)) return false; JvmThreadInstanceEntryImpl inst = getJvmThreadInstance(userData, oid); return (inst != null); }
Example #7
Source File: JVM_MANAGEMENT_MIB_IMPL.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * WARNING: This should probably be moved to JvmMemPoolTableMetaImpl **/ private int findInCache(SnmpTableHandler handler, String poolName) { if (!(handler instanceof SnmpCachedData)) { if (handler != null) { final String err = "Bad class for JvmMemPoolTable datas: " + handler.getClass().getName(); log.error("getJvmMemPoolEntry", err); } return -1; } final SnmpCachedData data = (SnmpCachedData)handler; final int len = data.datas.length; for (int i=0; i < data.datas.length ; i++) { final MemoryPoolMXBean pool = (MemoryPoolMXBean) data.datas[i]; if (poolName.equals(pool.getName())) return i; } return -1; }
Example #8
Source File: JvmMemGCTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 #9
Source File: JvmMemGCTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); try { if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid, using the GC filter. // final SnmpOid next = filter.getNext(handler,oid); if (dbg) log.debug("getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; } catch (RuntimeException x) { // debug. This should never happen. // if (dbg) log.debug("getNextOid",x); throw x; } }
Example #10
Source File: JvmMemGCTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 #11
Source File: JvmMemMgrPoolRelTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #12
Source File: JvmMemPoolTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #13
Source File: JvmMemPoolTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); try { if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; } catch (SnmpStatusException x) { if (dbg) log.debug("getNextOid", "End of MIB View: " + x); throw x; } catch (RuntimeException r) { if (dbg) log.debug("getNextOid", "Unexpected exception: " + r); if (dbg) log.debug("getNextOid",r); throw r; } }
Example #14
Source File: JvmMemMgrPoolRelTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData, SnmpCachedData mmHandler, SnmpTableHandler mpHandler, Map<String, SnmpOid> poolIndexMap) { final SnmpOid[] indexes = mmHandler.indexes; final Object[] datas = mmHandler.datas; final int size = indexes.length; for (int i=size-1; i>-1; i--) { final MemoryManagerMXBean mmm = (MemoryManagerMXBean)datas[i]; if (mmm == null) continue; updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap); } }
Example #15
Source File: JvmRTClassPathTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #16
Source File: JvmMemPoolTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); try { if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; } catch (SnmpStatusException x) { if (dbg) log.debug("getNextOid", "End of MIB View: " + x); throw x; } catch (RuntimeException r) { if (dbg) log.debug("getNextOid", "Unexpected exception: " + r); if (dbg) log.debug("getNextOid",r); throw r; } }
Example #17
Source File: JVM_MANAGEMENT_MIB_IMPL.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * WARNING: This should probably be moved to JvmMemPoolTableMetaImpl **/ private SnmpOid getJvmMemPoolEntryIndex(SnmpTableHandler handler, String poolName) { final int index = findInCache(handler,poolName); if (index < 0) return null; return ((SnmpCachedData)handler).indexes[index]; }
Example #18
Source File: JvmRTBootClassPathTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }
Example #19
Source File: JVM_MANAGEMENT_MIB_IMPL.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * WARNING: This should probably be moved to JvmMemPoolTableMetaImpl **/ private SnmpTableHandler getJvmMemPoolTableHandler(Object userData) { final SnmpMibTable meta = getRegisteredTableMeta("JvmMemPoolTable"); if (! (meta instanceof JvmMemPoolTableMetaImpl)) { final String err = ((meta==null)?"No metadata for JvmMemPoolTable": "Bad metadata class for JvmMemPoolTable: " + meta.getClass().getName()); log.error("getJvmMemPoolTableHandler", err); return null; } final JvmMemPoolTableMetaImpl memPoolTable = (JvmMemPoolTableMetaImpl) meta; return memPoolTable.getHandler(userData); }
Example #20
Source File: JvmThreadInstanceTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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); // handler should never be null. // 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; }
Example #21
Source File: JvmMemGCTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); try { if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid, using the GC filter. // final SnmpOid next = filter.getNext(handler,oid); if (dbg) log.debug("getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; } catch (RuntimeException x) { // debug. This should never happen. // if (dbg) log.debug("getNextOid",x); throw x; } }
Example #22
Source File: JvmMemGCTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 #23
Source File: JvmThreadInstanceTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // SnmpOid next = oid; while(true) { next = handler.getNext(next); if (next == null) break; if (getJvmThreadInstance(userData,next) != null) break; } log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }
Example #24
Source File: JvmMemManagerTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #25
Source File: JvmMemManagerTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #26
Source File: JvmThreadInstanceTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // SnmpOid next = oid; while(true) { next = handler.getNext(next); if (next == null) break; if (getJvmThreadInstance(userData,next) != null) break; } log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }
Example #27
Source File: JvmRTInputArgsTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }
Example #28
Source File: JvmRTClassPathTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected boolean contains(SnmpOid oid, Object userData) { // Get the handler. // SnmpTableHandler handler = getHandler(userData); // handler should never be null. // if (handler == null) return false; return handler.contains(oid); }
Example #29
Source File: JvmRTClassPathTableMetaImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }
Example #30
Source File: JvmRTClassPathTableMetaImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected SnmpOid getNextOid(SnmpOid oid, Object userData) throws SnmpStatusException { final boolean dbg = log.isDebugOn(); if (dbg) log.debug("getNextOid", "previous=" + oid); // Get the data handler. // SnmpTableHandler handler = getHandler(userData); if (handler == null) { // This should never happen. // If we get here it's a bug. // if (dbg) log.debug("getNextOid", "handler is null!"); throw new SnmpStatusException(SnmpStatusException.noSuchInstance); } // Get the next oid // final SnmpOid next = handler.getNext(oid); if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next); // if next is null: we reached the end of the table. // if (next == null) throw new SnmpStatusException(SnmpStatusException.noSuchInstance); return next; }