提交 ed0fea2e 编写于 作者: S sjiang

8130710: Better attributes processing

Reviewed-by: jbachorik, dfuchs, ahgross
上级 b27e84d3
...@@ -361,7 +361,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -361,7 +361,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
"connectionId=" + connectionId "connectionId=" + connectionId
+", className=" + className +", className=" + className
+", name=" + name +", name=" + name
+", params=" + objects(values)
+", signature=" + strings(signature)); +", signature=" + strings(signature));
return (ObjectInstance) return (ObjectInstance)
...@@ -427,7 +426,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -427,7 +426,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
+", className=" + className +", className=" + className
+", name=" + name +", name=" + name
+", loaderName=" + loaderName +", loaderName=" + loaderName
+", params=" + objects(values)
+", signature=" + strings(signature)); +", signature=" + strings(signature));
return (ObjectInstance) return (ObjectInstance)
...@@ -719,7 +717,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -719,7 +717,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
if (debug) logger.debug("setAttribute", if (debug) logger.debug("setAttribute",
"connectionId=" + connectionId "connectionId=" + connectionId
+", name="+name +", name="+name
+", attribute="+attr); +", attribute name="+attr.getName());
doPrivilegedOperation( doPrivilegedOperation(
SET_ATTRIBUTE, SET_ATTRIBUTE,
...@@ -770,7 +768,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -770,7 +768,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
if (debug) logger.debug("setAttributes", if (debug) logger.debug("setAttributes",
"connectionId=" + connectionId "connectionId=" + connectionId
+", name="+name +", name="+name
+", attributes="+attrlist); +", attribute names="+RMIConnector.getAttributesNames(attrlist));
return (AttributeList) return (AttributeList)
doPrivilegedOperation( doPrivilegedOperation(
...@@ -825,7 +823,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -825,7 +823,6 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
"connectionId=" + connectionId "connectionId=" + connectionId
+", name="+name +", name="+name
+", operationName="+operationName +", operationName="+operationName
+", params="+objects(values)
+", signature="+strings(signature)); +", signature="+strings(signature));
return return
......
...@@ -41,7 +41,6 @@ import java.io.NotSerializableException; ...@@ -41,7 +41,6 @@ import java.io.NotSerializableException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectStreamClass; import java.io.ObjectStreamClass;
import java.io.Serializable; import java.io.Serializable;
import java.io.WriteAbortedException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
...@@ -70,6 +69,7 @@ import java.util.Map; ...@@ -70,6 +69,7 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.stream.Collectors;
import javax.management.Attribute; import javax.management.Attribute;
import javax.management.AttributeList; import javax.management.AttributeList;
import javax.management.AttributeNotFoundException; import javax.management.AttributeNotFoundException;
...@@ -712,9 +712,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -712,9 +712,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (logger.debugOn()) if (logger.debugOn())
logger.debug("createMBean(String,ObjectName,Object[],String[])", logger.debug("createMBean(String,ObjectName,Object[],String[])",
"className=" + className + ", name=" "className=" + className + ", name="
+ name + ", params=" + name + ", signature=" + strings(signature));
+ objects(params) + ", signature="
+ strings(signature));
final MarshalledObject<Object[]> sParams = final MarshalledObject<Object[]> sParams =
new MarshalledObject<Object[]>(params); new MarshalledObject<Object[]>(params);
...@@ -753,8 +751,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -753,8 +751,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (logger.debugOn()) logger.debug( if (logger.debugOn()) logger.debug(
"createMBean(String,ObjectName,ObjectName,Object[],String[])", "createMBean(String,ObjectName,ObjectName,Object[],String[])",
"className=" + className + ", name=" + name + ", loaderName=" "className=" + className + ", name=" + name + ", loaderName="
+ loaderName + ", params=" + objects(params) + loaderName + ", signature=" + strings(signature));
+ ", signature=" + strings(signature));
final MarshalledObject<Object[]> sParams = final MarshalledObject<Object[]> sParams =
new MarshalledObject<Object[]>(params); new MarshalledObject<Object[]>(params);
...@@ -954,8 +951,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -954,8 +951,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
IOException { IOException {
if (logger.debugOn()) logger.debug("setAttribute", if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute=" "name=" + name + ", attribute name="
+ attribute); + attribute.getName());
final MarshalledObject<Attribute> sAttribute = final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute); new MarshalledObject<Attribute>(attribute);
...@@ -977,9 +974,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -977,9 +974,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
ReflectionException, ReflectionException,
IOException { IOException {
if (logger.debugOn()) logger.debug("setAttributes", if (logger.debugOn()) {
"name=" + name + ", attributes=" logger.debug("setAttributes",
+ attributes); "name=" + name + ", attribute names="
+ getAttributesNames(attributes));
}
final MarshalledObject<AttributeList> sAttributes = final MarshalledObject<AttributeList> sAttributes =
new MarshalledObject<AttributeList>(attributes); new MarshalledObject<AttributeList>(attributes);
...@@ -1012,7 +1011,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1012,7 +1011,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (logger.debugOn()) logger.debug("invoke", if (logger.debugOn()) logger.debug("invoke",
"name=" + name "name=" + name
+ ", operationName=" + operationName + ", operationName=" + operationName
+ ", params=" + objects(params)
+ ", signature=" + strings(signature)); + ", signature=" + strings(signature));
final MarshalledObject<Object[]> sParams = final MarshalledObject<Object[]> sParams =
...@@ -2636,4 +2634,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2636,4 +2634,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
private static String strings(final String[] strs) { private static String strings(final String[] strs) {
return objects(strs); return objects(strs);
} }
static String getAttributesNames(AttributeList attributes) {
return attributes != null ?
attributes.asList().stream()
.map(Attribute::getName)
.collect(Collectors.joining("[", ", ", "]"))
: "[]";
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册