Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
d154aa09
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d154aa09
编写于
7月 13, 2018
作者:
R
redestad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8207235: ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class) throws NPE
Reviewed-by: alanb
上级
735ddd08
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
40 deletion
+41
-40
src/java.base/share/classes/java/nio/Bits.java
src/java.base/share/classes/java/nio/Bits.java
+18
-37
src/java.base/share/classes/java/nio/Buffer.java
src/java.base/share/classes/java/nio/Buffer.java
+21
-0
src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
...a.base/share/classes/jdk/internal/misc/SharedSecrets.java
+2
-3
未找到文件。
src/java.base/share/classes/java/nio/Bits.java
浏览文件 @
d154aa09
...
...
@@ -207,43 +207,24 @@ class Bits { // package-private
assert
cnt
>=
0
&&
reservedMem
>=
0
&&
totalCap
>=
0
;
}
// -- Monitoring of direct buffer usage --
static
{
// setup access to this package in SharedSecrets
SharedSecrets
.
setJavaNioAccess
(
new
JavaNioAccess
()
{
@Override
public
JavaNioAccess
.
BufferPool
getDirectBufferPool
()
{
return
new
JavaNioAccess
.
BufferPool
()
{
@Override
public
String
getName
()
{
return
"direct"
;
}
@Override
public
long
getCount
()
{
return
Bits
.
COUNT
.
get
();
}
@Override
public
long
getTotalCapacity
()
{
return
Bits
.
TOTAL_CAPACITY
.
get
();
}
@Override
public
long
getMemoryUsed
()
{
return
Bits
.
RESERVED_MEMORY
.
get
();
}
};
}
@Override
public
ByteBuffer
newDirectByteBuffer
(
long
addr
,
int
cap
,
Object
ob
)
{
return
new
DirectByteBuffer
(
addr
,
cap
,
ob
);
}
@Override
public
void
truncate
(
Buffer
buf
)
{
buf
.
truncate
();
}
});
}
static
final
JavaNioAccess
.
BufferPool
BUFFER_POOL
=
new
JavaNioAccess
.
BufferPool
()
{
@Override
public
String
getName
()
{
return
"direct"
;
}
@Override
public
long
getCount
()
{
return
Bits
.
COUNT
.
get
();
}
@Override
public
long
getTotalCapacity
()
{
return
Bits
.
TOTAL_CAPACITY
.
get
();
}
@Override
public
long
getMemoryUsed
()
{
return
Bits
.
RESERVED_MEMORY
.
get
();
}
};
// These numbers represent the point at which we have empirically
// determined that the average cost of a JNI call exceeds the expense
...
...
src/java.base/share/classes/java/nio/Buffer.java
浏览文件 @
d154aa09
...
...
@@ -26,6 +26,8 @@
package
java.nio
;
import
jdk.internal.HotSpotIntrinsicCandidate
;
import
jdk.internal.misc.JavaNioAccess
;
import
jdk.internal.misc.SharedSecrets
;
import
jdk.internal.misc.Unsafe
;
import
java.util.Spliterator
;
...
...
@@ -707,4 +709,23 @@ public abstract class Buffer {
throw
new
IndexOutOfBoundsException
();
}
static
{
// setup access to this package in SharedSecrets
SharedSecrets
.
setJavaNioAccess
(
new
JavaNioAccess
()
{
@Override
public
JavaNioAccess
.
BufferPool
getDirectBufferPool
()
{
return
Bits
.
BUFFER_POOL
;
}
@Override
public
ByteBuffer
newDirectByteBuffer
(
long
addr
,
int
cap
,
Object
ob
)
{
return
new
DirectByteBuffer
(
addr
,
cap
,
ob
);
}
@Override
public
void
truncate
(
Buffer
buf
)
{
buf
.
truncate
();
}
});
}
}
src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
浏览文件 @
d154aa09
...
...
@@ -194,10 +194,9 @@ public class SharedSecrets {
public
static
JavaNioAccess
getJavaNioAccess
()
{
if
(
javaNioAccess
==
null
)
{
// Ensure java.nio.ByteOrder is initialized; we know that
// this class initializes java.nio.Bits that provides the
// Ensure java.nio.Buffer is initialized, which provides the
// shared secret.
unsafe
.
ensureClassInitialized
(
java
.
nio
.
B
yteOrd
er
.
class
);
unsafe
.
ensureClassInitialized
(
java
.
nio
.
B
uff
er
.
class
);
}
return
javaNioAccess
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录