Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
88d00694
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
88d00694
编写于
2月 14, 2011
作者:
M
mduigou
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
2c6ea287
a82c3326
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
35 deletion
+53
-35
src/share/classes/sun/tools/jps/Jps.java
src/share/classes/sun/tools/jps/Jps.java
+46
-30
test/java/nio/file/Files/walkFileTree/PrintFileTree.java
test/java/nio/file/Files/walkFileTree/PrintFileTree.java
+7
-5
未找到文件。
src/share/classes/sun/tools/jps/Jps.java
浏览文件 @
88d00694
/*
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004,
2011,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -77,9 +77,52 @@ public class Jps {
...
@@ -77,9 +77,52 @@ public class Jps {
MonitoredVm
vm
=
null
;
MonitoredVm
vm
=
null
;
String
vmidString
=
"//"
+
lvmid
+
"?mode=r"
;
String
vmidString
=
"//"
+
lvmid
+
"?mode=r"
;
String
errorString
=
null
;
try
{
try
{
// Note: The VM associated with the current VM id may
// no longer be running so these queries may fail. We
// already added the VM id to the output stream above.
// If one of the queries fails, then we try to add a
// reasonable message to indicate that the requested
// info is not available.
errorString
=
" -- process information unavailable"
;
VmIdentifier
id
=
new
VmIdentifier
(
vmidString
);
VmIdentifier
id
=
new
VmIdentifier
(
vmidString
);
vm
=
monitoredHost
.
getMonitoredVm
(
id
,
0
);
vm
=
monitoredHost
.
getMonitoredVm
(
id
,
0
);
errorString
=
" -- main class information unavailable"
;
output
.
append
(
" "
+
MonitoredVmUtil
.
mainClass
(
vm
,
arguments
.
showLongPaths
()));
if
(
arguments
.
showMainArgs
())
{
errorString
=
" -- main args information unavailable"
;
String
mainArgs
=
MonitoredVmUtil
.
mainArgs
(
vm
);
if
(
mainArgs
!=
null
&&
mainArgs
.
length
()
>
0
)
{
output
.
append
(
" "
+
mainArgs
);
}
}
if
(
arguments
.
showVmArgs
())
{
errorString
=
" -- jvm args information unavailable"
;
String
jvmArgs
=
MonitoredVmUtil
.
jvmArgs
(
vm
);
if
(
jvmArgs
!=
null
&&
jvmArgs
.
length
()
>
0
)
{
output
.
append
(
" "
+
jvmArgs
);
}
}
if
(
arguments
.
showVmFlags
())
{
errorString
=
" -- jvm flags information unavailable"
;
String
jvmFlags
=
MonitoredVmUtil
.
jvmFlags
(
vm
);
if
(
jvmFlags
!=
null
&&
jvmFlags
.
length
()
>
0
)
{
output
.
append
(
" "
+
jvmFlags
);
}
}
errorString
=
" -- detach failed"
;
monitoredHost
.
detach
(
vm
);
System
.
out
.
println
(
output
);
errorString
=
null
;
}
catch
(
URISyntaxException
e
)
{
}
catch
(
URISyntaxException
e
)
{
// unexpected as vmidString is based on a validated hostid
// unexpected as vmidString is based on a validated hostid
lastError
=
e
;
lastError
=
e
;
...
@@ -87,7 +130,7 @@ public class Jps {
...
@@ -87,7 +130,7 @@ public class Jps {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
lastError
=
e
;
lastError
=
e
;
}
finally
{
}
finally
{
if
(
vm
=
=
null
)
{
if
(
errorString
!
=
null
)
{
/*
/*
* we ignore most exceptions, as there are race
* we ignore most exceptions, as there are race
* conditions where a JVM in 'jvms' may terminate
* conditions where a JVM in 'jvms' may terminate
...
@@ -95,7 +138,7 @@ public class Jps {
...
@@ -95,7 +138,7 @@ public class Jps {
* Other errors, such as access and I/O exceptions
* Other errors, such as access and I/O exceptions
* should stop us from iterating over the complete set.
* should stop us from iterating over the complete set.
*/
*/
output
.
append
(
" -- process information unavailable"
);
output
.
append
(
errorString
);
if
(
arguments
.
isDebug
())
{
if
(
arguments
.
isDebug
())
{
if
((
lastError
!=
null
)
if
((
lastError
!=
null
)
&&
(
lastError
.
getMessage
()
!=
null
))
{
&&
(
lastError
.
getMessage
()
!=
null
))
{
...
@@ -110,33 +153,6 @@ public class Jps {
...
@@ -110,33 +153,6 @@ public class Jps {
continue
;
continue
;
}
}
}
}
output
.
append
(
" "
);
output
.
append
(
MonitoredVmUtil
.
mainClass
(
vm
,
arguments
.
showLongPaths
()));
if
(
arguments
.
showMainArgs
())
{
String
mainArgs
=
MonitoredVmUtil
.
mainArgs
(
vm
);
if
(
mainArgs
!=
null
&&
mainArgs
.
length
()
>
0
)
{
output
.
append
(
" "
).
append
(
mainArgs
);
}
}
if
(
arguments
.
showVmArgs
())
{
String
jvmArgs
=
MonitoredVmUtil
.
jvmArgs
(
vm
);
if
(
jvmArgs
!=
null
&&
jvmArgs
.
length
()
>
0
)
{
output
.
append
(
" "
).
append
(
jvmArgs
);
}
}
if
(
arguments
.
showVmFlags
())
{
String
jvmFlags
=
MonitoredVmUtil
.
jvmFlags
(
vm
);
if
(
jvmFlags
!=
null
&&
jvmFlags
.
length
()
>
0
)
{
output
.
append
(
" "
).
append
(
jvmFlags
);
}
}
System
.
out
.
println
(
output
);
monitoredHost
.
detach
(
vm
);
}
}
}
catch
(
MonitorException
e
)
{
}
catch
(
MonitorException
e
)
{
if
(
e
.
getMessage
()
!=
null
)
{
if
(
e
.
getMessage
()
!=
null
)
{
...
...
test/java/nio/file/Files/walkFileTree/PrintFileTree.java
浏览文件 @
88d00694
...
@@ -54,6 +54,7 @@ public class PrintFileTree {
...
@@ -54,6 +54,7 @@ public class PrintFileTree {
if
(
followLinks
)
if
(
followLinks
)
options
.
add
(
FileVisitOption
.
FOLLOW_LINKS
);
options
.
add
(
FileVisitOption
.
FOLLOW_LINKS
);
final
boolean
follow
=
followLinks
;
final
boolean
reportCycles
=
printCycles
;
final
boolean
reportCycles
=
printCycles
;
Files
.
walkFileTree
(
dir
,
options
,
Integer
.
MAX_VALUE
,
new
FileVisitor
<
Path
>()
{
Files
.
walkFileTree
(
dir
,
options
,
Integer
.
MAX_VALUE
,
new
FileVisitor
<
Path
>()
{
@Override
@Override
...
@@ -63,8 +64,7 @@ public class PrintFileTree {
...
@@ -63,8 +64,7 @@ public class PrintFileTree {
}
}
@Override
@Override
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
{
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
{
if
(!
attrs
.
isDirectory
()
||
reportCycles
)
System
.
out
.
println
(
file
);
System
.
out
.
println
(
file
);
return
FileVisitResult
.
CONTINUE
;
return
FileVisitResult
.
CONTINUE
;
}
}
@Override
@Override
...
@@ -79,11 +79,13 @@ public class PrintFileTree {
...
@@ -79,11 +79,13 @@ public class PrintFileTree {
public
FileVisitResult
visitFileFailed
(
Path
file
,
IOException
exc
)
public
FileVisitResult
visitFileFailed
(
Path
file
,
IOException
exc
)
throws
IOException
throws
IOException
{
{
if
(
reportCycles
&&
(
exc
instanceof
FileSystemLoopException
))
{
if
(
follow
&&
(
exc
instanceof
FileSystemLoopException
))
{
System
.
out
.
println
(
file
);
if
(
reportCycles
)
System
.
out
.
println
(
file
);
return
FileVisitResult
.
CONTINUE
;
return
FileVisitResult
.
CONTINUE
;
}
else
{
throw
exc
;
}
}
throw
exc
;
}
}
});
});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录