jdk/src/share/classes/sun/management/MemoryPoolImpl.java
public void setCollectionUsageThreshold(long newThreshold) {
if (!isCollectionUsageThresholdSupported()) {
throw new UnsupportedOperationException(
"CollectionUsage 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 +
" > max (" + usage.getMax() + ").");
}
synchronized (this) {
if (!gcSensorRegistered) {
// pass the sensor to VM to begin monitoring
gcSensorRegistered = true;
setPoolCollectionSensor(gcSensor);
}
setCollectionThreshold0(collectionThreshold, newThreshold);
this.collectionThreshold = newThreshold;
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.