On 7/1/12 5:39 PM, David Holmes wrote:
Now, how can the test fail? If ref is never cleared, the while loop will
never terminate, and we rely on jtreg to timeout and kill this test. It
would be good to have a brief comment above the while loop that explains
this.

Agreed. Something like

// Might require multiple calls to System.gc() for weak-references processing
to be complete.
// If the weak-reference is not cleared as expected we will hang here
// until timed out by the test harness

Though now I write that I'm unhappy that this will only behave nicely if run
from jtreg. We do use explicit timeouts in other tests.

So, are you unhappy enough that we should ask Eric to add an explicit timeout?

I don't think it would be that difficult. Perhaps a technique like the following would suffice. Get System.currentTimeMillis() before the loop, and call it again each time through the loop, and fail if the difference is greater than the timeout (e.g., 60 sec). Doesn't involve other threads or even Timer/TimerTask.

On the other hand if one is running this test directly instead of through jtreg, one can just ^C it if it's taking an unexpectedly long time.

s'marks

Reply via email to