提交 ed0fea2e 编写于 作者: S sjiang

8130710: Better attributes processing

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