/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7036199
* @summary Check that GarbageCollectionNotification contents are reasonable
* @author Frederic Parain
*/
import javax.management.*;
public class GarbageCollectionNotificationContentTest {
synchronized(synchronizer) {
count++;
}
}
}
}
}
}
final Boolean isNotificationSupported = AccessController.doPrivileged (new PrivilegedAction<Boolean>() {
try {
f.setAccessible(true);
return f.getBoolean(null);
} catch(ClassNotFoundException e) {
return false;
} catch(NoSuchFieldException e) {
return false;
} catch(IllegalAccessException e) {
return false;
}
}
});
if(!isNotificationSupported) {
return;
}
final ObjectName gcMXBeanPattern =
new ObjectName("java.lang:type=GarbageCollector,*");
throw new Exception("Test incorrect: no GC MXBeans");
for (ObjectName n : names) {
}
}
// Invocation of System.gc() to trigger major GC
// Allocation of many short living and small objects to trigger minor GC
for(int i = 0; i<100000000; i++) {
}
int wakeup = 0;
synchronized(synchronizer) {
wakeup++;
if(wakeup > 10)
break;
}
}
}
}
private static void checkGarbageCollectionNotificationInfoContent(GarbageCollectionNotificationInfo notif) throws Exception {
throw new RuntimeException("After Gc Memory does not exist" +
" for " + poolname);
}
}
// check if memory usage for all memory pools are returned
for (MemoryPoolMXBean p : pools ) {
throw new RuntimeException("GcInfo does not contain " +
"memory usage for pool " + p.getName());
}
}
}
}