Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8287887: Remove finalization testing from vmTestbase/gc/gctests/PhantomReference/phantom001/phantom001.java #9053

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -44,8 +44,6 @@
* 2. reference.get() returns null.
* 3. queue.poll() returns the reference that was created.
* 4. queue.poll() again returns null.
* 5. If the checked type is class (Referent), then it must be finalized,
* since the reference is already enqueued.
* The test extends ThreadedGCTest and implements GarbageProducerAware and
* MemoryStrategyAware interfaces. The corresponding javadoc documentation
* for additional test configuration.
@@ -88,7 +86,6 @@ public static void main(String[] args) {
class Test implements Runnable {

int iteration;
private volatile boolean finalized;

private String addMessageContext(String message) {
return "T:" + Thread.currentThread().getId() +
@@ -174,24 +171,6 @@ public void run() {
type = "class";
}

// If referent is finalizable, provoke GCs and wait for finalization.
if (type.equals("class")) {
progress("Waiting for finalization: " + type);
for (int checks = 0; !finalized && !shouldTerminate(); ++checks) {
// There are scenarios where one WB.fillGC() isn't enough,
// but 10 iterations really ought to be sufficient.
if (checks > 10) {
fail("Waiting for finalization: " + type);
return;
}
WhiteBox.getWhiteBox().fullGC();
// Give some time for finalizer to run.
try {
Thread.sleep(checks * 100);
} catch (InterruptedException e) {}
}
}

// Provoke GCs and wait for reference to be enqueued.
progress("Waiting for enqueue: " + type);
Reference polled = queue.poll();
@@ -232,15 +211,6 @@ public void run() {
}

class Referent {

//We need discard this flag to make second and following checks with type.equals("class") useful
public Referent() {
finalized = false;
}

protected void finalize() {
finalized = true;
}
}
}