diff options
Diffstat (limited to 'jurt/com/sun/star/lib/uno/bridges/java_remote')
-rw-r--r-- | jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java | 15 | ||||
-rw-r--r-- | jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java | 12 |
2 files changed, 17 insertions, 10 deletions
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java index edcceca44757..e249062fa07e 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java @@ -57,6 +57,10 @@ final class ProxyFactory { } } + public void dispose() throws InterruptedException { + asynchronousFinalizer.drain(); + } + public static XBridge getBridge(Object obj) { if (Proxy.isProxyClass(obj.getClass())) { InvocationHandler h = Proxy.getInvocationHandler(obj); @@ -126,13 +130,10 @@ final class ProxyFactory { @Override protected void finalize() { - AsynchronousFinalizer.add(new AsynchronousFinalizer.Job() { + decrementDebugCount(); + asynchronousFinalizer.add(new AsynchronousFinalizer.Job() { public void run() throws Throwable { - try { - request("release", null); - } finally { - decrementDebugCount(); - } + request("release", null); } }); } @@ -187,4 +188,6 @@ final class ProxyFactory { private final RequestHandler requestHandler; private final XBridge bridge; + private final AsynchronousFinalizer asynchronousFinalizer = + new AsynchronousFinalizer(); } diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java index 722f825e6ba5..48784283a99a 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java @@ -499,7 +499,12 @@ public class java_remote_bridge try { _messageDispatcher.terminate(); - _xConnection.close(); + try { + _xConnection.close(); + } catch (com.sun.star.io.IOException e) { + System.err.println( + getClass().getName() + ".dispose - IOException:" + e); + } if (Thread.currentThread() != _messageDispatcher && _messageDispatcher.isAlive()) @@ -519,6 +524,8 @@ public class java_remote_bridge // assert _java_environment instanceof java_environment; ((java_environment) _java_environment).revokeAllProxies(); + proxyFactory.dispose(); + if (DEBUG) { if (_life_count != 0) { System.err.println(getClass().getName() @@ -535,9 +542,6 @@ public class java_remote_bridge } catch (InterruptedException e) { System.err.println(getClass().getName() + ".dispose - InterruptedException:" + e); - } catch (com.sun.star.io.IOException e) { - System.err.println(getClass().getName() + ".dispose - IOException:" - + e); } } |