From a30ca9cb0a7fb85e7fd9d9b24701e99c608be82d Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 28 Oct 2010 14:20:43 +0200 Subject: sb132: #i109191# avoid early finalization of Java URP proxies --- .../sun/star/lib/uno/bridges/java_remote/ProxyFactory.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'jurt/com') 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; -- cgit