Skip to content

Commit 3140b78

Browse files
committed
Attempt to fix windows test failures
1 parent d1be99a commit 3140b78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/com/sun/jna/CallbacksTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@ public void callback() {
375375
for (int i = 0; i < Cleaner.MASTER_CLEANUP_INTERVAL_MS / 10 + 5 && (cbstruct.peer != 0 || refs.size() > 0); ++i) {
376376
// Flush weak hash map
377377
refs.size();
378-
try {
379-
Thread.sleep(Cleaner.MASTER_CLEANUP_INTERVAL_MS + 10); // Give the GC a chance to run
378+
Thread.sleep(10); // Give the GC a chance to run
379+
synchronized (CallbacksTest.class) { // the cbstruct.peer cleanup happens in a different thread, make sure we see it here
380380
System.gc();
381-
} finally {}
381+
}
382382
}
383383
assertEquals("Callback trampoline not freed", 0, cbstruct.peer);
384384
}

0 commit comments

Comments
 (0)