summaryrefslogtreecommitdiff
path: root/javaunohelper
diff options
context:
space:
mode:
authorRobert Antoni Buj i Gelonch <robert.buj@gmail.com>2014-10-02 11:19:12 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-10-02 09:21:32 +0000
commit18ceb207ddd8e9065a8e0bd4a64163a3a2a0a0ce (patch)
tree405ad04f2e8cce44ca39e7506ed0fdf04dc466c8 /javaunohelper
parentca7899d64d8fc8b6902af33d50a2b50ca3c841ac (diff)
javaunohelper: More robust way to wait for finalization
Change-Id: I09fa2462d8131381f380574b8a9aeaf080211b2b Reviewed-on: https://gerrit.libreoffice.org/11759 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'javaunohelper')
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
index ef9fdbf8e0bd..07200b6b0fb5 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java
@@ -34,6 +34,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import util.WaitUnreachable;
public class WeakBase_Test
{
@@ -81,12 +82,9 @@ public class WeakBase_Test
adapter.addReference(aRef2);
assertSame(adapter.queryAdapted(), comp);
+ WaitUnreachable u = new WaitUnreachable(comp);
comp= null;
- logger.log(Level.FINE, "Wait 51ms (-XX:MaxGCPauseMillis=50)");
- System.gc();
- System.runFinalization();
- Thread.sleep(51);
-
+ u.waitUnreachable();
assertEquals(aRef1.nDisposeCalled, 1);
assertEquals(aRef2.nDisposeCalled, 1);
assertNull(adapter.queryAdapted());
@@ -102,11 +100,9 @@ public class WeakBase_Test
adapter.addReference(aRef2);
adapter.removeReference(aRef1);
- logger.log(Level.FINE, "Wait 51ms (-XX:MaxGCPauseMillis=50)");
+ u = new WaitUnreachable(comp);
comp= null;
- System.gc();
- System.runFinalization();
- Thread.sleep(51);
+ u.waitUnreachable();
assertEquals(aRef1.nDisposeCalled, 0);
assertEquals(aRef2.nDisposeCalled, 1);
}