test/java/lang/ref/EarlyTimeout.java
Print this page
*** 61,73 ****
EarlyTimeout[] threads = new EarlyTimeout[THREADS_COUNT];
for (int i = 0; i < THREADS_COUNT; ++i) {
threads[i] = new EarlyTimeout();
threads[i].start();
}
- startedSignal.await();
referent = null;
System.gc();
for (EarlyTimeout thread : threads) {
thread.join();
}
if (weakReference.get() != null) {
throw new RuntimeException("weakReference was not cleared");
--- 61,73 ----
EarlyTimeout[] threads = new EarlyTimeout[THREADS_COUNT];
for (int i = 0; i < THREADS_COUNT; ++i) {
threads[i] = new EarlyTimeout();
threads[i].start();
}
referent = null;
System.gc();
+ startedSignal.await();
for (EarlyTimeout thread : threads) {
thread.join();
}
if (weakReference.get() != null) {
throw new RuntimeException("weakReference was not cleared");
*** 80,90 ****
}
if (thread.reference != null && thread.reference == weakReference) {
nonNullRefCount++;
}
}
! if (nonNullRefCount != 1) {
throw new RuntimeException("more than one references were removed from queue");
}
}
public void run() {
--- 80,93 ----
}
if (thread.reference != null && thread.reference == weakReference) {
nonNullRefCount++;
}
}
! if (nonNullRefCount == 0) {
! System.err.println("no references were removed from queue");
! }
! if (nonNullRefCount > 1) {
throw new RuntimeException("more than one references were removed from queue");
}
}
public void run() {