Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6bce28ac
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看板
提交
6bce28ac
编写于
2月 07, 2011
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7012823: TEST_BUG: java/nio/MappedByteBuffer tests leave file mappingsthat prevent clean-up (win)
Reviewed-by: forax
上级
59400f76
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
20 deletion
+26
-20
test/java/nio/MappedByteBuffer/Force.java
test/java/nio/MappedByteBuffer/Force.java
+12
-9
test/java/nio/MappedByteBuffer/ZeroMap.java
test/java/nio/MappedByteBuffer/ZeroMap.java
+14
-11
未找到文件。
test/java/nio/MappedByteBuffer/Force.java
浏览文件 @
6bce28ac
...
...
@@ -37,14 +37,17 @@ public class Force {
Random
random
=
new
Random
();
long
filesize
=
random
.
nextInt
(
3
*
1024
*
1024
);
int
cut
=
random
.
nextInt
((
int
)
filesize
);
File
file
=
new
File
(
"Blah"
);
RandomAccessFile
raf
=
new
RandomAccessFile
(
file
,
"rw"
);
raf
.
setLength
(
filesize
);
FileChannel
fc
=
raf
.
getChannel
();
MappedByteBuffer
buf1
=
fc
.
map
(
FileChannel
.
MapMode
.
READ_WRITE
,
cut
,
filesize
-
cut
);
buf1
.
force
();
fc
.
close
();
raf
.
close
();
File
file
=
File
.
createTempFile
(
"Blah"
,
null
);
file
.
deleteOnExit
();
try
(
RandomAccessFile
raf
=
new
RandomAccessFile
(
file
,
"rw"
))
{
raf
.
setLength
(
filesize
);
FileChannel
fc
=
raf
.
getChannel
();
MappedByteBuffer
mbb
=
fc
.
map
(
FileChannel
.
MapMode
.
READ_WRITE
,
cut
,
filesize
-
cut
);
mbb
.
force
();
}
// improve chance that mapped buffer will be unmapped
System
.
gc
();
Thread
.
sleep
(
500
);
}
}
test/java/nio/MappedByteBuffer/ZeroMap.java
浏览文件 @
6bce28ac
...
...
@@ -37,16 +37,19 @@ public class ZeroMap {
Random
random
=
new
Random
();
long
filesize
=
random
.
nextInt
(
1024
*
1024
);
int
cut
=
random
.
nextInt
((
int
)
filesize
);
File
file
=
new
File
(
"Blah"
);
RandomAccessFile
raf
=
new
RandomAccessFile
(
file
,
"rw"
);
raf
.
setLength
(
filesize
);
FileChannel
fc
=
raf
.
getChannel
();
MappedByteBuffer
buf1
=
fc
.
map
(
FileChannel
.
MapMode
.
READ_WRITE
,
cut
,
0
);
buf1
.
force
();
buf1
.
load
();
buf1
.
isLoaded
();
fc
.
close
();
raf
.
close
();
File
file
=
File
.
createTempFile
(
"Blah"
,
null
);
file
.
deleteOnExit
();
try
(
RandomAccessFile
raf
=
new
RandomAccessFile
(
file
,
"rw"
))
{
raf
.
setLength
(
filesize
);
FileChannel
fc
=
raf
.
getChannel
();
MappedByteBuffer
mbb
=
fc
.
map
(
FileChannel
.
MapMode
.
READ_WRITE
,
cut
,
0
);
mbb
.
force
();
mbb
.
load
();
mbb
.
isLoaded
();
}
// improve chance that mapped buffer will be unmapped
System
.
gc
();
Thread
.
sleep
(
500
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录