Top


定義場所(file name)

jdk/src/share/classes/sun/management/MemoryPoolImpl.java

名前(function name)

    public void setUsageThreshold(long newThreshold) {

本体部(body)

            if (!isUsageThresholdSupported()) {
                throw new UnsupportedOperationException(
                    "Usage threshold is not supported");
            }

            Util.checkControlAccess();

            MemoryUsage usage = getUsage0();
            if (newThreshold < 0) {
                throw new IllegalArgumentException(
                    "Invalid threshold: " + newThreshold);
            }

            if (usage.getMax() != -1 && newThreshold > usage.getMax()) {
                throw new IllegalArgumentException(
                    "Invalid threshold: " + newThreshold +
                    " must be <= maxSize." +
                    " Committed = " + usage.getCommitted() +
                    " Max = " + usage.getMax());
            }

            synchronized (this) {
                if (!usageSensorRegistered) {
                    // pass the sensor to VM to begin monitoring
                    usageSensorRegistered = true;
                    setPoolUsageSensor(usageSensor);
                }
                setUsageThreshold0(usageThreshold, newThreshold);
                this.usageThreshold = newThreshold;
            }
        }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.