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
commita30ca9cb0a7fb85e7fd9d9b24701e99c608be82d (patch)
tree290a7288ed86fd46baebc34b72d2a0423adb1c96 /jurt
parent59b2504a550efd12a50fff9adac34138229384e1 (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 b81db391966f..ae2719f1c07d 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;