Skip to content

Commit

Permalink
JDK-8244297
Browse files Browse the repository at this point in the history
more improvements based on code-review
  • Loading branch information
FlorianKirmaier committed Oct 28, 2020
1 parent 91bda93 commit 6ece3a7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static int checkCollectable(int stepsLeft, WeakReference weakReference)
}

/**
* Checks whether the content of the WeakReference can not be collected.
* Checks whether the content of the WeakReference cannot be collected.
* @param weakReference The WeakReference to check.
*/
public static void assertNotCollectable(WeakReference weakReference) {
Expand All @@ -141,11 +141,14 @@ public static void assertNotCollectable(WeakReference weakReference) {
}

/**
* Checks whether the content of the WeakReference can not be collected.
* Checks whether the content of the WeakReference cannot be collected.
* @param weakReference The WeakReference to check.
* @return Returns true, when the provided WeakReference can not be collected.
* @return Returns true, when the provided WeakReference cannot be collected.
*/
public static boolean checkNotCollectable(WeakReference weakReference) {
createGarbage();
System.gc();
System.runFinalization();
createGarbage();
System.gc();
return weakReference.get() != null;
Expand Down Expand Up @@ -212,11 +215,8 @@ public void setAsReferenced(Object ref) {
throw new AssertionError("The following references should be collected: " + toBeCollectedMarked + " and " + toBeNotCollected.size() + " should not be collected: " + toBeNotCollectedMarked);
}
}


}


static void createHeapDump() {
if (createHeapdump) {
try {
Expand Down

0 comments on commit 6ece3a7

Please sign in to comment.