Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
aafb7ceb
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看板
提交
aafb7ceb
编写于
6月 27, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6844054: (bf) Eliminate dependency on javax.management.ObjectName
Reviewed-by: mchung
上级
2f6c346f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
105 addition
and
112 deletion
+105
-112
src/share/classes/java/lang/management/PlatformComponent.java
...share/classes/java/lang/management/PlatformComponent.java
+1
-5
src/share/classes/java/nio/Bits.java
src/share/classes/java/nio/Bits.java
+21
-45
src/share/classes/java/nio/Direct-X-Buffer.java
src/share/classes/java/nio/Direct-X-Buffer.java
+0
-1
src/share/classes/sun/management/ManagementFactoryHelper.java
...share/classes/sun/management/ManagementFactoryHelper.java
+53
-16
src/share/classes/sun/misc/JavaNioAccess.java
src/share/classes/sun/misc/JavaNioAccess.java
+10
-3
src/share/classes/sun/nio/ch/FileChannelImpl.java
src/share/classes/sun/nio/ch/FileChannelImpl.java
+20
-42
未找到文件。
src/share/classes/java/lang/management/PlatformComponent.java
浏览文件 @
aafb7ceb
...
@@ -34,7 +34,6 @@ import java.util.logging.LoggingMXBean;
...
@@ -34,7 +34,6 @@ import java.util.logging.LoggingMXBean;
import
java.util.logging.LogManager
;
import
java.util.logging.LogManager
;
import
java.nio.BufferPoolMXBean
;
import
java.nio.BufferPoolMXBean
;
import
javax.management.MBeanServerConnection
;
import
javax.management.MBeanServerConnection
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
import
javax.management.ObjectName
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
...
@@ -198,10 +197,7 @@ enum PlatformComponent {
...
@@ -198,10 +197,7 @@ enum PlatformComponent {
"java.nio"
,
"BufferPool"
,
keyProperties
(
"name"
),
"java.nio"
,
"BufferPool"
,
keyProperties
(
"name"
),
new
MXBeanFetcher
<
BufferPoolMXBean
>()
{
new
MXBeanFetcher
<
BufferPoolMXBean
>()
{
public
List
<
BufferPoolMXBean
>
getMXBeans
()
{
public
List
<
BufferPoolMXBean
>
getMXBeans
()
{
List
<
BufferPoolMXBean
>
pools
=
new
ArrayList
<
BufferPoolMXBean
>(
2
);
return
ManagementFactoryHelper
.
getBufferPoolMXBeans
();
pools
.
add
(
sun
.
misc
.
SharedSecrets
.
getJavaNioAccess
().
getDirectBufferPoolMXBean
()
);
pools
.
add
(
sun
.
nio
.
ch
.
FileChannelImpl
.
getMappedBufferPoolMXBean
()
);
return
pools
;
}
}
}),
}),
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
aafb7ceb
...
@@ -26,11 +26,8 @@
...
@@ -26,11 +26,8 @@
package
java.nio
;
package
java.nio
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
sun.misc.Unsafe
;
import
sun.misc.Unsafe
;
import
sun.misc.VM
;
import
sun.misc.VM
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
/**
/**
* Access to bits, native and otherwise.
* Access to bits, native and otherwise.
...
@@ -676,40 +673,18 @@ class Bits { // package-private
...
@@ -676,40 +673,18 @@ class Bits { // package-private
}
}
}
}
// -- M
anagement interface for m
onitoring of direct buffer usage --
// -- Monitoring of direct buffer usage --
static
{
static
{
// setup access to this package in SharedSecrets
// setup access to this package in SharedSecrets
sun
.
misc
.
SharedSecrets
.
setJavaNioAccess
(
sun
.
misc
.
SharedSecrets
.
setJavaNioAccess
(
new
sun
.
misc
.
JavaNioAccess
()
{
new
sun
.
misc
.
JavaNioAccess
()
{
@Override
@Override
public
BufferPoolMXBean
getDirectBufferPoolMXBean
()
{
public
sun
.
misc
.
JavaNioAccess
.
BufferPool
getDirectBufferPool
()
{
return
LazyInitialization
.
directBufferPoolMXBean
;
return
new
sun
.
misc
.
JavaNioAccess
.
BufferPool
()
{
}
}
);
}
// Lazy initialization of management interface
private
static
class
LazyInitialization
{
static
final
BufferPoolMXBean
directBufferPoolMXBean
=
directBufferPoolMXBean
();
private
static
BufferPoolMXBean
directBufferPoolMXBean
()
{
final
String
pool
=
"direct"
;
final
ObjectName
obj
;
try
{
obj
=
new
ObjectName
(
"java.nio:type=BufferPool,name="
+
pool
);
}
catch
(
MalformedObjectNameException
x
)
{
throw
new
AssertionError
(
x
);
}
return
new
BufferPoolMXBean
()
{
@Override
public
ObjectName
getObjectName
()
{
return
obj
;
}
@Override
@Override
public
String
getName
()
{
public
String
getName
()
{
return
pool
;
return
"direct"
;
}
}
@Override
@Override
public
long
getCount
()
{
public
long
getCount
()
{
...
@@ -725,6 +700,7 @@ class Bits { // package-private
...
@@ -725,6 +700,7 @@ class Bits { // package-private
}
}
};
};
}
}
});
}
}
// -- Bulk get/put acceleration --
// -- Bulk get/put acceleration --
...
...
src/share/classes/java/nio/Direct-X-Buffer.java
浏览文件 @
aafb7ceb
...
@@ -30,7 +30,6 @@ package java.nio;
...
@@ -30,7 +30,6 @@ package java.nio;
import
sun.misc.Cleaner
;
import
sun.misc.Cleaner
;
import
sun.misc.Unsafe
;
import
sun.misc.Unsafe
;
import
sun.nio.ch.DirectBuffer
;
import
sun.nio.ch.DirectBuffer
;
import
sun.nio.ch.FileChannelImpl
;
class
Direct
$Type$Buffer$RW
$
$BO
$
class
Direct
$Type$Buffer$RW
$
$BO
$
...
...
src/share/classes/sun/management/ManagementFactoryHelper.java
浏览文件 @
aafb7ceb
...
@@ -26,22 +26,15 @@
...
@@ -26,22 +26,15 @@
package
sun.management
;
package
sun.management
;
import
java.lang.management.*
;
import
java.lang.management.*
;
import
java.util.logging.LogManager
;
import
javax.management.DynamicMBean
;
import
javax.management.MBeanServer
;
import
javax.management.MBeanServer
;
import
javax.management.MBeanServerFactory
;
import
javax.management.MBeanInfo
;
import
javax.management.NotificationEmitter
;
import
javax.management.ObjectName
;
import
javax.management.ObjectName
;
import
javax.management.ObjectInstance
;
import
javax.management.InstanceAlreadyExistsException
;
import
javax.management.InstanceAlreadyExistsException
;
import
javax.management.InstanceNotFoundException
;
import
javax.management.InstanceNotFoundException
;
import
javax.management.MBeanRegistrationException
;
import
javax.management.MBeanRegistrationException
;
import
javax.management.NotCompliantMBeanException
;
import
javax.management.NotCompliantMBeanException
;
import
javax.management.RuntimeOperationsException
;
import
javax.management.RuntimeOperationsException
;
import
javax.management.StandardEmitterMBean
;
import
java.nio.BufferPoolMXBean
;
import
javax.management.StandardMBean
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.security.PrivilegedExceptionAction
;
...
@@ -49,11 +42,6 @@ import sun.security.action.LoadLibraryAction;
...
@@ -49,11 +42,6 @@ import sun.security.action.LoadLibraryAction;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Iterator
;
import
java.util.ListIterator
;
import
com.sun.management.OSMBeanFactory
;
import
com.sun.management.OSMBeanFactory
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
...
@@ -68,7 +56,6 @@ public class ManagementFactoryHelper {
...
@@ -68,7 +56,6 @@ public class ManagementFactoryHelper {
private
static
VMManagement
jvm
;
private
static
VMManagement
jvm
;
private
static
boolean
mbeansCreated
=
false
;
private
static
ClassLoadingImpl
classMBean
=
null
;
private
static
ClassLoadingImpl
classMBean
=
null
;
private
static
MemoryImpl
memoryMBean
=
null
;
private
static
MemoryImpl
memoryMBean
=
null
;
private
static
ThreadImpl
threadMBean
=
null
;
private
static
ThreadImpl
threadMBean
=
null
;
...
@@ -148,6 +135,58 @@ public class ManagementFactoryHelper {
...
@@ -148,6 +135,58 @@ public class ManagementFactoryHelper {
return
result
;
return
result
;
}
}
public
static
List
<
BufferPoolMXBean
>
getBufferPoolMXBeans
()
{
List
<
BufferPoolMXBean
>
pools
=
new
ArrayList
<
BufferPoolMXBean
>(
2
);
pools
.
add
(
createBufferPoolMXBean
(
sun
.
misc
.
SharedSecrets
.
getJavaNioAccess
()
.
getDirectBufferPool
()));
pools
.
add
(
createBufferPoolMXBean
(
sun
.
nio
.
ch
.
FileChannelImpl
.
getMappedBufferPool
()));
return
pools
;
}
private
final
static
String
BUFFER_POOL_MXBEAN_NAME
=
"java.nio:type=BufferPool"
;
/**
* Creates management interface for the given buffer pool.
*/
private
static
BufferPoolMXBean
createBufferPoolMXBean
(
final
sun
.
misc
.
JavaNioAccess
.
BufferPool
pool
)
{
return
new
BufferPoolMXBean
()
{
private
volatile
ObjectName
objname
;
// created lazily
@Override
public
ObjectName
getObjectName
()
{
ObjectName
result
=
objname
;
if
(
result
==
null
)
{
synchronized
(
this
)
{
if
(
objname
==
null
)
{
result
=
ObjectName
.
valueOf
(
BUFFER_POOL_MXBEAN_NAME
+
",name="
+
pool
.
getName
());
objname
=
result
;
}
}
}
return
result
;
}
@Override
public
String
getName
()
{
return
pool
.
getName
();
}
@Override
public
long
getCount
()
{
return
pool
.
getCount
();
}
@Override
public
long
getTotalCapacity
()
{
return
pool
.
getTotalCapacity
();
}
@Override
public
long
getMemoryUsed
()
{
return
pool
.
getMemoryUsed
();
}
};
}
private
static
HotSpotDiagnostic
hsDiagMBean
=
null
;
private
static
HotSpotDiagnostic
hsDiagMBean
=
null
;
private
static
HotspotRuntime
hsRuntimeMBean
=
null
;
private
static
HotspotRuntime
hsRuntimeMBean
=
null
;
private
static
HotspotClassLoading
hsClassMBean
=
null
;
private
static
HotspotClassLoading
hsClassMBean
=
null
;
...
@@ -162,8 +201,6 @@ public class ManagementFactoryHelper {
...
@@ -162,8 +201,6 @@ public class ManagementFactoryHelper {
return
hsDiagMBean
;
return
hsDiagMBean
;
}
}
/**
/**
/**
* This method is for testing only.
* This method is for testing only.
*/
*/
...
...
src/share/classes/sun/misc/JavaNioAccess.java
浏览文件 @
aafb7ceb
...
@@ -25,8 +25,15 @@
...
@@ -25,8 +25,15 @@
package
sun.misc
;
package
sun.misc
;
import
java.nio.BufferPoolMXBean
;
public
interface
JavaNioAccess
{
public
interface
JavaNioAccess
{
BufferPoolMXBean
getDirectBufferPoolMXBean
();
/**
* Provides access to information on buffer usage.
*/
interface
BufferPool
{
String
getName
();
long
getCount
();
long
getTotalCapacity
();
long
getMemoryUsed
();
}
BufferPool
getDirectBufferPool
();
}
}
src/share/classes/sun/nio/ch/FileChannelImpl.java
浏览文件 @
aafb7ceb
...
@@ -29,13 +29,10 @@ import java.io.FileDescriptor;
...
@@ -29,13 +29,10 @@ import java.io.FileDescriptor;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.BufferPoolMXBean
;
import
java.nio.channels.*
;
import
java.nio.channels.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
import
sun.misc.Cleaner
;
import
sun.misc.Cleaner
;
import
sun.security.action.GetPropertyAction
;
import
sun.security.action.GetPropertyAction
;
...
@@ -805,32 +802,14 @@ public class FileChannelImpl
...
@@ -805,32 +802,14 @@ public class FileChannelImpl
}
}
/**
/**
* Returns the management interface for mapped buffers
* Invoked by sun.management.ManagementFactoryHelper to create the management
* interface for mapped buffers.
*/
*/
public
static
BufferPoolMXBean
getMappedBufferPoolMXBean
()
{
public
static
sun
.
misc
.
JavaNioAccess
.
BufferPool
getMappedBufferPool
()
{
return
LazyInitialization
.
mappedBufferPoolMXBean
;
return
new
sun
.
misc
.
JavaNioAccess
.
BufferPool
()
{
}
// Lazy initialization of management interface
private
static
class
LazyInitialization
{
static
final
BufferPoolMXBean
mappedBufferPoolMXBean
=
mappedBufferPoolMXBean
();
private
static
BufferPoolMXBean
mappedBufferPoolMXBean
()
{
final
String
pool
=
"mapped"
;
final
ObjectName
obj
;
try
{
obj
=
new
ObjectName
(
"java.nio:type=BufferPool,name="
+
pool
);
}
catch
(
MalformedObjectNameException
x
)
{
throw
new
AssertionError
(
x
);
}
return
new
BufferPoolMXBean
()
{
@Override
public
ObjectName
getObjectName
()
{
return
obj
;
}
@Override
@Override
public
String
getName
()
{
public
String
getName
()
{
return
pool
;
return
"mapped"
;
}
}
@Override
@Override
public
long
getCount
()
{
public
long
getCount
()
{
...
@@ -846,7 +825,6 @@ public class FileChannelImpl
...
@@ -846,7 +825,6 @@ public class FileChannelImpl
}
}
};
};
}
}
}
// -- Locks --
// -- Locks --
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录