Mercurial > hg > openjdk > aarch64-port > jdk
changeset 11010:217fa7205549 jdk8u51-b13
Merge
author | mfang |
---|---|
date | Mon, 18 May 2015 10:33:17 -0700 |
parents | ca7f2ba4cf32 (current diff) 27beb7ba8b16 (diff) |
children | c9987cf52d6a |
files | |
diffstat | 2 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java Mon May 18 10:05:58 2015 -0700 +++ b/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java Mon May 18 10:33:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.rmi.Remote; import java.rmi.UnexpectedException; import java.rmi.activation.Activatable; +import java.security.PrivilegedAction; import java.util.Map; import java.util.WeakHashMap; import sun.rmi.server.Util; @@ -56,6 +57,25 @@ { private static final long serialVersionUID = 2L; + // set to true if invocation handler allows finalize method (legacy behavior) + private static final boolean allowFinalizeInvocation; + + static { + String propName = "sun.rmi.server.invocationhandler.allowFinalizeInvocation"; + String allowProp = java.security.AccessController.doPrivileged( + new PrivilegedAction<String>() { + @Override + public String run() { + return System.getProperty(propName); + } + }); + if ("".equals(allowProp)) { + allowFinalizeInvocation = true; + } else { + allowFinalizeInvocation = Boolean.parseBoolean(allowProp); + } + } + /** * A weak hash map, mapping classes to weak hash maps that map * method objects to method hashes. @@ -144,6 +164,9 @@ { if (method.getDeclaringClass() == Object.class) { return invokeObjectMethod(proxy, method, args); + } else if ("finalize".equals(method.getName()) && method.getParameterCount() == 0 && + !allowFinalizeInvocation) { + return null; // ignore } else { return invokeRemoteMethod(proxy, method, args); }
--- a/test/javax/management/monitor/CounterMonitorTest.java Mon May 18 10:05:58 2015 -0700 +++ b/test/javax/management/monitor/CounterMonitorTest.java Mon May 18 10:33:17 2015 -0700 @@ -68,7 +68,7 @@ observedValue = count; CounterMonitorTest.class.notifyAll(); } - return count; + return observedValue; } public void setNbObjects(Object n) { echo(">>> StdObservedObject.setNbObjects: " + n);