summaryrefslogtreecommitdiff
path: root/jurt
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-10-28 14:20:43 +0200
committersb <sb@openoffice.org>2010-10-28 14:20:43 +0200
commit36dff4041dd46301ea5a2ae4b9cc7fbfab5d351a (patch)
tree2992774dc4b53e408a9c76071659b31cd54f7e1c /jurt
parent5ad20a1cdc02437a991b0100d0a6273be69544e6 (diff)
sb132: #i109191# avoid early finalization of Java URP proxies
Diffstat (limited to 'jurt')
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java13
1 files changed, 12 insertions, 1 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 631bda3a1..fd7fefdad 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
@@ -148,11 +148,22 @@ final class ProxyFactory {
private Object request(String operation, Object[] args) throws Throwable
{
- return requestHandler.sendRequest(oid, type, operation, args);
+ Object res = requestHandler.sendRequest(oid, type, operation, args);
+ // Avoid early finalization of this object, while an invoke ->
+ // request call is still ongoing; as finalize also calls request,
+ // this should fulfil the condition from The Java Language
+ // Specification, 3rd ed., that "if an object's finalizer can result
+ // in synchronization on that object, then that object must be alive
+ // and considered reachable whenever a lock is held on it:"
+ synchronized (this) {
+ ++dummy;
+ }
+ return res;
}
private final String oid;
private final Type type;
+ private int dummy = 0;
}
private static final Method METHOD_EQUALS;