Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
16fb0598
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
16fb0598
编写于
10月 01, 2013
作者:
E
egahlin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6696975: JTop plugin fails if connected readonly to target JVM
Reviewed-by: mchung, jbachorik, sla, sjiang
上级
f67b28d6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
5 deletion
+48
-5
src/share/demo/management/JTop/JTop.java
src/share/demo/management/JTop/JTop.java
+48
-5
未找到文件。
src/share/demo/management/JTop/JTop.java
浏览文件 @
16fb0598
/*
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -87,12 +87,36 @@ import javax.swing.table.*;
*/
public
class
JTop
extends
JPanel
{
private
static
class
StatusBar
extends
JPanel
{
private
static
final
long
serialVersionUID
=
-
6483392381797633018L
;
private
final
JLabel
statusText
;
public
StatusBar
(
boolean
defaultVisible
)
{
super
(
new
GridLayout
(
1
,
1
));
statusText
=
new
JLabel
();
statusText
.
setVisible
(
defaultVisible
);
add
(
statusText
);
}
@Override
public
Dimension
getMaximumSize
()
{
Dimension
maximum
=
super
.
getMaximumSize
();
Dimension
minimum
=
getMinimumSize
();
return
new
Dimension
(
maximum
.
width
,
minimum
.
height
);
}
public
void
setMessage
(
String
text
)
{
statusText
.
setText
(
text
);
statusText
.
setVisible
(
true
);
}
}
private
static
final
long
serialVersionUID
=
-
1499762160973870696L
;
private
MBeanServerConnection
server
;
private
ThreadMXBean
tmbean
;
private
MyTableModel
tmodel
;
private
final
StatusBar
statusBar
;
public
JTop
()
{
super
(
new
Grid
Layout
(
1
,
0
));
super
(
new
Grid
BagLayout
(
));
tmodel
=
new
MyTableModel
();
JTable
table
=
new
JTable
(
tmodel
);
...
...
@@ -108,7 +132,22 @@ public class JTop extends JPanel {
JScrollPane
scrollPane
=
new
JScrollPane
(
table
);
// Add the scroll pane to this panel.
add
(
scrollPane
);
GridBagConstraints
c1
=
new
GridBagConstraints
();
c1
.
fill
=
GridBagConstraints
.
BOTH
;
c1
.
gridy
=
0
;
c1
.
gridx
=
0
;
c1
.
weightx
=
1
;
c1
.
weighty
=
1
;
add
(
scrollPane
,
c1
);
statusBar
=
new
StatusBar
(
false
);
GridBagConstraints
c2
=
new
GridBagConstraints
();
c2
.
fill
=
GridBagConstraints
.
HORIZONTAL
;
c2
.
gridy
=
1
;
c2
.
gridx
=
0
;
c2
.
weightx
=
1.0
;
c2
.
weighty
=
0.0
;
add
(
statusBar
,
c2
);
}
// Set the MBeanServerConnection object for communicating
...
...
@@ -123,9 +162,13 @@ public class JTop extends JPanel {
e
.
printStackTrace
();
}
if
(!
tmbean
.
isThreadCpuTimeSupported
())
{
System
.
err
.
println
(
"This VM does not support thread CPU time monitoring
"
);
statusBar
.
setMessage
(
"Monitored VM does not support thread CPU time measurement
"
);
}
else
{
tmbean
.
setThreadCpuTimeEnabled
(
true
);
try
{
tmbean
.
setThreadCpuTimeEnabled
(
true
);
}
catch
(
SecurityException
e
)
{
statusBar
.
setMessage
(
"Monitored VM does not have permission for enabling thread cpu time measurement"
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录