On 2/25/14 6:32 AM, Ivan Gerasimov wrote:
line 76: why do you want to catch InterruptedException? If
interrupted, should the test fail?
ReferenceQueue#remove() can throw InterruptedException, so I had to
handle it.
In the new webrev I set the initial value of actual to TIMEOUT, so if
the thread is interrupted the test will pass.
Catching the InterruptedException would hide any unexpected issue as the
test doesn't really expect to be interrupted. For example if the test is
interrupted (kill -9), we should let the test to fail which is fine. I
suggest not to catch it.
line 61: I think the test should be:
if (thread.reference != null || thread.actual < TIMEOUT)
you may want to update the exception. You could simply throw
RuntimeException (just a minor point).
Please take a look at the updated webrev:
http://cr.openjdk.java.net/~igerasim/6853696/1/webrev/
Looks okay. I have a slight preference to keep the simple division to
convert to millis rather than loading the enum TimeUnit class for this
purpose.
Mandy