本文整理汇总了Java中sun.hotspot.WhiteBox.g1InConcurrentMark方法的典型用法代码示例。如果您正苦于以下问题:Java WhiteBox.g1InConcurrentMark方法的具体用法?Java WhiteBox.g1InConcurrentMark怎么用?Java WhiteBox.g1InConcurrentMark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.hotspot.WhiteBox
的用法示例。
在下文中一共展示了WhiteBox.g1InConcurrentMark方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
WhiteBox wb = WhiteBox.getWhiteBox();
wb.youngGC();
assertTrue(wb.g1StartConcMarkCycle());
while (wb.g1InConcurrentMark()) {
Thread.sleep(5);
}
wb.fullGC();
assertTrue(wb.g1StartConcMarkCycle());
while (wb.g1InConcurrentMark()) {
Thread.sleep(5);
}
assertTrue(wb.g1StartConcMarkCycle());
}
示例2: waitTillCMCFinished
import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
/**
* Waits until Concurent Mark Cycle finishes
* @param wb Whitebox instance
* @param sleepTime sleep time
*/
public static void waitTillCMCFinished(WhiteBox wb, int sleepTime) {
while (wb.g1InConcurrentMark()) {
if (sleepTime > -1) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
System.out.println("Got InterruptedException while waiting for ConcMarkCycle to finish");
}
}
}
}
示例3: main
import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException{
WhiteBox wb = WhiteBox.getWhiteBox();
LinkedList<Object> garbageAndRefList = new LinkedList<Object>();
// Creating a 1M large byte array. Since the test specifies the heap
// region size to be 1m this will be a humongous object. We then
// store a pointer to the array in the static object to keep it live
// during the whole test.
humongous_reference_holder = new LargeRef(new byte[1 * 1024 * 1024]);
// Create some garbage and a reference to the humongous object each round.
for (int i = 0; i < 32; i++) {
garbageAndRefList.add(new byte[400*1000]);
garbageAndRefList.add(new LargeRef(humongous_reference_holder.ref()));
// Promote to old, goal is to get rem-set entries for the humongous
// object from different regions. The test specifies MaxTenuringThreshold=0,
// this will make sure we get objects promoted to old at once.
wb.youngGC();
}
// Clear the garbage and reference list.
garbageAndRefList.clear();
// Run a concurrent mark cycle to mark all references but the static one as dead.
wb.g1StartConcMarkCycle();
while (wb.g1InConcurrentMark()) {
Thread.sleep(100);
}
// Run a young collection to make sure humongous object still can't be eagerly reclaimed.
wb.youngGC();
// Will crash/assert if humongous object has been reclaimed.
wb.fullGC();
}
示例4: main
import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
WhiteBox wb = WhiteBox.getWhiteBox();
// Run a concurrent mark cycle to trigger the liveness accounting log messages.
wb.g1StartConcMarkCycle();
while (wb.g1InConcurrentMark()) {
Thread.sleep(100);
}
}
示例5: waitTillCMCFinished
import sun.hotspot.WhiteBox; //导入方法依赖的package包/类
/**
* Waits until Concurent Mark Cycle finishes
*
* @param wb Whitebox instance
* @param sleepTime sleep time
*/
public static void waitTillCMCFinished(WhiteBox wb, int sleepTime) {
while (wb.g1InConcurrentMark()) {
if (sleepTime > -1) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
System.out.println("Got InterruptedException while waiting for ConcMarkCycle to finish");
Thread.currentThread().interrupt();
break;
}
}
}
}