sun.management.snmp.util.JvmContextFactory Java Examples

The following examples show how to use sun.management.snmp.util.JvmContextFactory. 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: JvmMemoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setter for the "JvmMemoryGCCall" variable.
 */
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
    throws SnmpStatusException {
    if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        try {
            ManagementFactory.getMemoryMXBean().gc();
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallStarted);
        } catch (Exception ex) {
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallFailed);
        }
        return;
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
 
Example #2
Source File: JvmMemoryImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setter for the "JvmMemoryGCCall" variable.
 */
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
    throws SnmpStatusException {
    if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        try {
            ManagementFactory.getMemoryMXBean().gc();
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallStarted);
        } catch (Exception ex) {
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallFailed);
        }
        return;
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
 
Example #3
Source File: JvmMemoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setter for the "JvmMemoryGCCall" variable.
 */
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
    throws SnmpStatusException {
    if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        try {
            ManagementFactory.getMemoryMXBean().gc();
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallStarted);
        } catch (Exception ex) {
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallFailed);
        }
        return;
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
 
Example #4
Source File: JvmMemoryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setter for the "JvmMemoryGCCall" variable.
 */
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
    throws SnmpStatusException {
    if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        try {
            ManagementFactory.getMemoryMXBean().gc();
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallStarted);
        } catch (Exception ex) {
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallFailed);
        }
        return;
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
 
Example #5
Source File: JvmMemoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setter for the "JvmMemoryGCCall" variable.
 */
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
    throws SnmpStatusException {
    if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        try {
            ManagementFactory.getMemoryMXBean().gc();
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallStarted);
        } catch (Exception ex) {
            if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
                                 JvmMemoryGCCallFailed);
        }
        return;
    }
    throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
 
Example #6
Source File: JvmMemPoolEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getPeakMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryPeakMemoryTag);
            if (cached != null) {
                if (log.isDebugOn())
                    log.debug("getPeakMemoryUsage",
                          entryPeakMemoryTag + " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getPeakUsage();
            if (u == null) u = ZEROS;

            m.put(entryPeakMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getPeakMemoryUsage", "ERROR: should never come here!");
        return ZEROS;
    } catch (RuntimeException x) {
        log.trace("getPeakMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getPeakMemoryUsage",x);
        throw x;
    }

}
 
Example #7
Source File: JvmMemoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getNonHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(nonHeapMemoryTag);
            if (cached != null) {
                log.debug("getNonHeapMemoryUsage",
                      "jvmMemory.getNonHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);

            //  getNonHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(nonHeapMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getNonHeapMemoryUsage",
                  "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.NON_HEAP);
    } catch (RuntimeException x) {
        log.trace("getNonHeapMemoryUsage",
              "Failed to get NonHeapMemoryUsage: " + x);
        log.debug("getNonHeapMemoryUsage",x);
        throw x;
    }

}
 
Example #8
Source File: JvmRuntimeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmRTInputArgsCount" variable.
 */
public Integer getJvmRTInputArgsCount() throws SnmpStatusException {

    final String[] args = getInputArguments(JvmContextFactory.
                                            getUserData());
    return new Integer(args.length);
}
 
Example #9
Source File: JvmThreadInstanceTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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 #10
Source File: JvmMemoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)m.get(heapMemoryTag);
            if (cached != null) {
                log.debug("getHeapMemoryUsage",
                      "jvmMemory.getHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.HEAP);

            // getHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(heapMemoryTag,u);
            return u;
        }

        // Should never come here.
        // Log error!
        log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.HEAP);
    } catch (RuntimeException x) {
        log.trace("getHeapMemoryUsage",
              "Failed to get HeapMemoryUsage: " + x);
        log.debug("getHeapMemoryUsage",x);
        throw x;
    }
}
 
Example #11
Source File: JvmMemoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getNonHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(nonHeapMemoryTag);
            if (cached != null) {
                log.debug("getNonHeapMemoryUsage",
                      "jvmMemory.getNonHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);

            //  getNonHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(nonHeapMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getNonHeapMemoryUsage",
                  "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.NON_HEAP);
    } catch (RuntimeException x) {
        log.trace("getNonHeapMemoryUsage",
              "Failed to get NonHeapMemoryUsage: " + x);
        log.debug("getNonHeapMemoryUsage",x);
        throw x;
    }

}
 
Example #12
Source File: JvmMemPoolEntryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getPeakMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryPeakMemoryTag);
            if (cached != null) {
                if (log.isDebugOn())
                    log.debug("getPeakMemoryUsage",
                          entryPeakMemoryTag + " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getPeakUsage();
            if (u == null) u = ZEROS;

            m.put(entryPeakMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getPeakMemoryUsage", "ERROR: should never come here!");
        return ZEROS;
    } catch (RuntimeException x) {
        log.trace("getPeakMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getPeakMemoryUsage",x);
        throw x;
    }

}
 
Example #13
Source File: JvmMemoryImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getNonHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(nonHeapMemoryTag);
            if (cached != null) {
                log.debug("getNonHeapMemoryUsage",
                      "jvmMemory.getNonHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);

            //  getNonHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(nonHeapMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getNonHeapMemoryUsage",
                  "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.NON_HEAP);
    } catch (RuntimeException x) {
        log.trace("getNonHeapMemoryUsage",
              "Failed to get NonHeapMemoryUsage: " + x);
        log.debug("getNonHeapMemoryUsage",x);
        throw x;
    }

}
 
Example #14
Source File: JvmRuntimeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmRTInputArgsCount" variable.
 */
public Integer getJvmRTInputArgsCount() throws SnmpStatusException {

    final String[] args = getInputArguments(JvmContextFactory.
                                            getUserData());
    return new Integer(args.length);
}
 
Example #15
Source File: JvmMemoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getNonHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(nonHeapMemoryTag);
            if (cached != null) {
                log.debug("getNonHeapMemoryUsage",
                      "jvmMemory.getNonHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);

            //  getNonHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(nonHeapMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getNonHeapMemoryUsage",
                  "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.NON_HEAP);
    } catch (RuntimeException x) {
        log.trace("getNonHeapMemoryUsage",
              "Failed to get NonHeapMemoryUsage: " + x);
        log.debug("getNonHeapMemoryUsage",x);
        throw x;
    }

}
 
Example #16
Source File: JvmThreadInstanceTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #17
Source File: JvmMemoryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmMemoryGCCall" variable.
 */
public EnumJvmMemoryGCCall getJvmMemoryGCCall()
    throws SnmpStatusException {
    final Map<Object,Object> m = JvmContextFactory.getUserData();

    if (m != null) {
        final EnumJvmMemoryGCCall cached
            = (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
        if (cached != null) return cached;
    }
    return JvmMemoryGCCallSupported;
}
 
Example #18
Source File: JvmMemPoolEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getCollectMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryCollectMemoryTag);
            if (cached != null) {
                if (log.isDebugOn())
                    log.debug("getCollectMemoryUsage",
                              entryCollectMemoryTag + " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getCollectionUsage();
            if (u == null) u = ZEROS;

            m.put(entryCollectMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getCollectMemoryUsage",
                  "ERROR: should never come here!");
        return ZEROS;
    } catch (RuntimeException x) {
        log.trace("getPeakMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getPeakMemoryUsage",x);
        throw x;
    }

}
 
Example #19
Source File: JvmMemoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmMemoryGCCall" variable.
 */
public EnumJvmMemoryGCCall getJvmMemoryGCCall()
    throws SnmpStatusException {
    final Map<Object,Object> m = JvmContextFactory.getUserData();

    if (m != null) {
        final EnumJvmMemoryGCCall cached
            = (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
        if (cached != null) return cached;
    }
    return JvmMemoryGCCallSupported;
}
 
Example #20
Source File: JvmMemoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)m.get(heapMemoryTag);
            if (cached != null) {
                log.debug("getHeapMemoryUsage",
                      "jvmMemory.getHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.HEAP);

            // getHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(heapMemoryTag,u);
            return u;
        }

        // Should never come here.
        // Log error!
        log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.HEAP);
    } catch (RuntimeException x) {
        log.trace("getHeapMemoryUsage",
              "Failed to get HeapMemoryUsage: " + x);
        log.debug("getHeapMemoryUsage",x);
        throw x;
    }
}
 
Example #21
Source File: JvmMemoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmMemoryGCCall" variable.
 */
public EnumJvmMemoryGCCall getJvmMemoryGCCall()
    throws SnmpStatusException {
    final Map<Object,Object> m = JvmContextFactory.getUserData();

    if (m != null) {
        final EnumJvmMemoryGCCall cached
            = (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
        if (cached != null) return cached;
    }
    return JvmMemoryGCCallSupported;
}
 
Example #22
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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 #23
Source File: JvmRuntimeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmRTInputArgsCount" variable.
 */
public Integer getJvmRTInputArgsCount() throws SnmpStatusException {

    final String[] args = getInputArguments(JvmContextFactory.
                                            getUserData());
    return new Integer(args.length);
}
 
Example #24
Source File: JvmMemPoolEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryMemoryTag);
            if (cached != null) {
                log.debug("getMemoryUsage",entryMemoryTag+
                      " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getUsage();
            if (u == null) u = ZEROS;

            m.put(entryMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getMemoryUsage", "ERROR: should never come here!");
        return pool.getUsage();
    } catch (RuntimeException x) {
        log.trace("getMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getMemoryUsage",x);
        throw x;
    }

}
 
Example #25
Source File: JvmMemPoolEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getPeakMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryPeakMemoryTag);
            if (cached != null) {
                if (log.isDebugOn())
                    log.debug("getPeakMemoryUsage",
                          entryPeakMemoryTag + " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getPeakUsage();
            if (u == null) u = ZEROS;

            m.put(entryPeakMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getPeakMemoryUsage", "ERROR: should never come here!");
        return ZEROS;
    } catch (RuntimeException x) {
        log.trace("getPeakMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getPeakMemoryUsage",x);
        throw x;
    }

}
 
Example #26
Source File: JvmMemPoolEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getCollectMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(entryCollectMemoryTag);
            if (cached != null) {
                if (log.isDebugOn())
                    log.debug("getCollectMemoryUsage",
                              entryCollectMemoryTag + " found in cache.");
                return cached;
            }

            MemoryUsage u = pool.getCollectionUsage();
            if (u == null) u = ZEROS;

            m.put(entryCollectMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getCollectMemoryUsage",
                  "ERROR: should never come here!");
        return ZEROS;
    } catch (RuntimeException x) {
        log.trace("getPeakMemoryUsage",
              "Failed to get MemoryUsage: " + x);
        log.debug("getPeakMemoryUsage",x);
        throw x;
    }

}
 
Example #27
Source File: JvmMemoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getNonHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)
                m.get(nonHeapMemoryTag);
            if (cached != null) {
                log.debug("getNonHeapMemoryUsage",
                      "jvmMemory.getNonHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);

            //  getNonHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(nonHeapMemoryTag,u);
            return u;
        }
        // Should never come here.
        // Log error!
        log.trace("getNonHeapMemoryUsage",
                  "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.NON_HEAP);
    } catch (RuntimeException x) {
        log.trace("getNonHeapMemoryUsage",
              "Failed to get NonHeapMemoryUsage: " + x);
        log.debug("getNonHeapMemoryUsage",x);
        throw x;
    }

}
 
Example #28
Source File: JvmMemoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
MemoryUsage getHeapMemoryUsage() {
    try {
        final Map<Object, Object> m = JvmContextFactory.getUserData();

        if (m != null) {
            final MemoryUsage cached = (MemoryUsage)m.get(heapMemoryTag);
            if (cached != null) {
                log.debug("getHeapMemoryUsage",
                      "jvmMemory.getHeapMemoryUsage found in cache.");
                return cached;
            }

            final MemoryUsage u = getMemoryUsage(MemoryType.HEAP);

            // getHeapMemoryUsage() never returns null.
            //
            // if (u == null) u=MemoryUsage.INVALID;

            m.put(heapMemoryTag,u);
            return u;
        }

        // Should never come here.
        // Log error!
        log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
        return getMemoryUsage(MemoryType.HEAP);
    } catch (RuntimeException x) {
        log.trace("getHeapMemoryUsage",
              "Failed to get HeapMemoryUsage: " + x);
        log.debug("getHeapMemoryUsage",x);
        throw x;
    }
}
 
Example #29
Source File: JvmThreadInstanceTableMetaImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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 #30
Source File: JvmRuntimeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmRTInputArgsCount" variable.
 */
public Integer getJvmRTInputArgsCount() throws SnmpStatusException {

    final String[] args = getInputArguments(JvmContextFactory.
                                            getUserData());
    return new Integer(args.length);
}