Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4bd13a57
Unverified
提交
4bd13a57
authored
7 年前
作者:
Noel Grandin
提交者:
GitHub
7 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #728 from katzyn/FakeFileChannel
Fix for issue #725: FilePathMem.tryLock() fails since Java 9
上级
07a0b62b
e3d363fd
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
109 行增加
和
9 行删除
+109
-9
FakeFileChannel.java
h2/src/main/org/h2/store/fs/FakeFileChannel.java
+104
-0
FilePathMem.java
h2/src/main/org/h2/store/fs/FilePathMem.java
+1
-2
FilePathNioMem.java
h2/src/main/org/h2/store/fs/FilePathNioMem.java
+1
-2
FilePathZip.java
h2/src/main/org/h2/store/fs/FilePathZip.java
+1
-2
FilePathZip2.java
h2/src/tools/org/h2/dev/fs/FilePathZip2.java
+2
-3
没有找到文件。
h2/src/main/org/h2/store/fs/FakeFileChannel.java
0 → 100644
浏览文件 @
4bd13a57
/*
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
store
.
fs
;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileLock
;
import
java.nio.channels.ReadableByteChannel
;
import
java.nio.channels.WritableByteChannel
;
/**
* Fake file channel to use by in-memory and ZIP file systems.
*/
public
class
FakeFileChannel
extends
FileChannel
{
@Override
protected
void
implCloseChannel
()
throws
IOException
{
throw
new
IOException
();
}
@Override
public
FileLock
lock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
MappedByteBuffer
map
(
MapMode
mode
,
long
position
,
long
size
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
position
()
throws
IOException
{
throw
new
IOException
();
}
@Override
public
FileChannel
position
(
long
newPosition
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
int
read
(
ByteBuffer
dst
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
read
(
ByteBuffer
[]
dsts
,
int
offset
,
int
length
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
size
()
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
transferFrom
(
ReadableByteChannel
src
,
long
position
,
long
count
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
transferTo
(
long
position
,
long
count
,
WritableByteChannel
target
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
FileChannel
truncate
(
long
size
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
int
write
(
ByteBuffer
src
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
int
write
(
ByteBuffer
src
,
long
position
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
long
write
(
ByteBuffer
[]
srcs
,
int
offset
,
int
len
)
throws
IOException
{
throw
new
IOException
();
}
@Override
public
void
force
(
boolean
metaData
)
throws
IOException
{
throw
new
IOException
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathMem.java
浏览文件 @
4bd13a57
...
...
@@ -392,8 +392,7 @@ class FileMem extends FileBase {
}
}
// cast to FileChannel to avoid JDK 1.7 ambiguity
FileLock
lock
=
new
FileLock
((
FileChannel
)
null
,
position
,
size
,
shared
)
{
FileLock
lock
=
new
FileLock
(
new
FakeFileChannel
(),
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathNioMem.java
浏览文件 @
4bd13a57
...
...
@@ -386,8 +386,7 @@ class FileNioMem extends FileBase {
}
}
// cast to FileChannel to avoid JDK 1.7 ambiguity
FileLock
lock
=
new
FileLock
((
FileChannel
)
null
,
position
,
size
,
shared
)
{
FileLock
lock
=
new
FileLock
(
new
FakeFileChannel
(),
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathZip.java
浏览文件 @
4bd13a57
...
...
@@ -354,8 +354,7 @@ class FileZip extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
// cast to FileChannel to avoid JDK 1.7 ambiguity
return
new
FileLock
((
FileChannel
)
null
,
position
,
size
,
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
(),
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/fs/FilePathZip2.java
浏览文件 @
4bd13a57
...
...
@@ -17,6 +17,7 @@ import java.util.zip.ZipEntry;
import
java.util.zip.ZipInputStream
;
import
org.h2.engine.Constants
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FakeFileChannel
;
import
org.h2.store.fs.FileBase
;
import
org.h2.store.fs.FileChannelInputStream
;
import
org.h2.store.fs.FilePath
;
...
...
@@ -426,9 +427,7 @@ class FileZip2 extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
// cast to FileChannel to avoid JDK 1.7 ambiguity
return
new
FileLock
((
FileChannel
)
null
,
position
,
size
,
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
(),
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论