Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ea16bc62
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ea16bc62
编写于
10月 16, 2017
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
eacb9165
03e032b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
43 deletion
+48
-43
src/share/classes/sun/management/Agent.java
src/share/classes/sun/management/Agent.java
+46
-41
src/share/classes/sun/management/resources/agent.properties
src/share/classes/sun/management/resources/agent.properties
+1
-1
test/com/sun/tools/attach/StartManagementAgent.java
test/com/sun/tools/attach/StartManagementAgent.java
+1
-1
未找到文件。
src/share/classes/sun/management/Agent.java
浏览文件 @
ea16bc62
...
...
@@ -34,7 +34,6 @@ import java.lang.management.ManagementFactory;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.net.InetAddress
;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
java.text.MessageFormat
;
import
java.util.MissingResourceException
;
...
...
@@ -88,7 +87,7 @@ public class Agent {
// return empty property set
private
static
Properties
parseString
(
String
args
)
{
Properties
argProps
=
new
Properties
();
if
(
args
!=
null
)
{
if
(
args
!=
null
&&
!
args
.
trim
().
equals
(
""
)
)
{
for
(
String
option
:
args
.
split
(
","
))
{
String
s
[]
=
option
.
split
(
"="
,
2
);
String
name
=
s
[
0
].
trim
();
...
...
@@ -160,53 +159,59 @@ public class Agent {
throw
new
RuntimeException
(
getText
(
INVALID_STATE
,
"Agent already started"
));
}
Properties
argProps
=
parseString
(
args
);
Properties
configProps
=
new
Properties
();
try
{
Properties
argProps
=
parseString
(
args
);
Properties
configProps
=
new
Properties
();
// Load the management properties from the config file
// if config file is not specified readConfiguration implicitly
// reads <java.home>/lib/management/management.properties
// Load the management properties from the config file
// if config file is not specified readConfiguration implicitly
// reads <java.home>/lib/management/management.properties
String
fname
=
System
.
getProperty
(
CONFIG_FILE
);
readConfiguration
(
fname
,
configProps
);
String
fname
=
System
.
getProperty
(
CONFIG_FILE
);
readConfiguration
(
fname
,
configProps
);
// management properties can be overridden by system properties
// which take precedence
Properties
sysProps
=
System
.
getProperties
();
synchronized
(
sysProps
)
{
configProps
.
putAll
(
sysProps
);
}
// management properties can be overridden by system properties
// which take precedence
Properties
sysProps
=
System
.
getProperties
();
synchronized
(
sysProps
)
{
configProps
.
putAll
(
sysProps
);
}
// if user specifies config file into command line for either
// jcmd utilities or attach command it overrides properties set in
// command line at the time of VM start
String
fnameUser
=
argProps
.
getProperty
(
CONFIG_FILE
);
if
(
fnameUser
!=
null
)
{
readConfiguration
(
fnameUser
,
configProps
);
}
// if user specifies config file into command line for either
// jcmd utilities or attach command it overrides properties set in
// command line at the time of VM start
String
fnameUser
=
argProps
.
getProperty
(
CONFIG_FILE
);
if
(
fnameUser
!=
null
)
{
readConfiguration
(
fnameUser
,
configProps
);
}
// arguments specified in command line of jcmd utilities
// override both system properties and one set by config file
// specified in jcmd command line
configProps
.
putAll
(
argProps
);
// arguments specified in command line of jcmd utilities
// override both system properties and one set by config file
// specified in jcmd command line
configProps
.
putAll
(
argProps
);
// jcmd doesn't allow to change ThreadContentionMonitoring, but user
// can specify this property inside config file, so enable optional
// monitoring functionality if this property is set
final
String
enableThreadContentionMonitoring
=
configProps
.
getProperty
(
ENABLE_THREAD_CONTENTION_MONITORING
);
// jcmd doesn't allow to change ThreadContentionMonitoring, but user
// can specify this property inside config file, so enable optional
// monitoring functionality if this property is set
final
String
enableThreadContentionMonitoring
=
configProps
.
getProperty
(
ENABLE_THREAD_CONTENTION_MONITORING
);
if
(
enableThreadContentionMonitoring
!=
null
)
{
ManagementFactory
.
getThreadMXBean
().
setThreadContentionMonitoringEnabled
(
true
);
}
if
(
enableThreadContentionMonitoring
!=
null
)
{
ManagementFactory
.
getThreadMXBean
().
setThreadContentionMonitoringEnabled
(
true
);
}
String
jmxremotePort
=
configProps
.
getProperty
(
JMXREMOTE_PORT
);
if
(
jmxremotePort
!=
null
)
{
jmxServer
=
ConnectorBootstrap
.
startRemoteConnectorServer
(
jmxremotePort
,
configProps
);
String
jmxremotePort
=
configProps
.
getProperty
(
JMXREMOTE_PORT
);
if
(
jmxremotePort
!=
null
)
{
jmxServer
=
ConnectorBootstrap
.
startRemoteConnectorServer
(
jmxremotePort
,
configProps
);
startDiscoveryService
(
configProps
);
startDiscoveryService
(
configProps
);
}
else
{
throw
new
AgentConfigurationError
(
INVALID_JMXREMOTE_PORT
,
"No port specified"
);
}
}
catch
(
AgentConfigurationError
err
)
{
error
(
err
.
getError
(),
err
.
getParams
());
}
}
...
...
@@ -507,7 +512,7 @@ public class Agent {
String
keyText
=
getText
(
key
);
System
.
err
.
print
(
getText
(
"agent.err.error"
)
+
": "
+
keyText
);
System
.
err
.
println
(
": "
+
message
);
throw
new
RuntimeException
(
keyText
);
throw
new
RuntimeException
(
keyText
+
": "
+
message
);
}
public
static
void
error
(
Exception
e
)
{
...
...
src/share/classes/sun/management/resources/agent.properties
浏览文件 @
ea16bc62
...
...
@@ -43,7 +43,7 @@ agent.err.agentclass.failed = Management agent class failed
agent.err.premain.notfound
=
premain(String) does not exist in agent class
agent.err.agentclass.access.denied
=
Access to premain(String) is denied
agent.err.invalid.agentclass
=
Invalid com.sun.management.agent.class property value
agent.err.invalid.state
=
Invalid agent state
agent.err.invalid.state
=
Invalid agent state
: {0}
agent.err.invalid.jmxremote.port
=
Invalid com.sun.management.jmxremote.port number
agent.err.invalid.jmxremote.rmi.port
=
Invalid com.sun.management.jmxremote.rmi.port number
...
...
test/com/sun/tools/attach/StartManagementAgent.java
浏览文件 @
ea16bc62
...
...
@@ -93,7 +93,7 @@ public class StartManagementAgent {
}
catch
(
AttachOperationFailedException
ex
)
{
// We expect parsing of "apa" above to fail, but if the file path
// can't be read we get a different exception message
if
(!
ex
.
getMessage
().
contains
(
"
java.lang.NumberFormatException
"
))
{
if
(!
ex
.
getMessage
().
contains
(
"
Invalid com.sun.management.jmxremote.port number
"
))
{
throw
ex
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录