Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6fc65dc4
提交
6fc65dc4
authored
6 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no need to allocate instances of FakeFileChannel
上级
e549c90c
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
12 行增加
和
8 行删除
+12
-8
FakeFileChannel.java
h2/src/main/org/h2/store/fs/FakeFileChannel.java
+8
-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
+1
-2
没有找到文件。
h2/src/main/org/h2/store/fs/FakeFileChannel.java
浏览文件 @
6fc65dc4
...
@@ -17,6 +17,14 @@ import java.nio.channels.WritableByteChannel;
...
@@ -17,6 +17,14 @@ import java.nio.channels.WritableByteChannel;
* Fake file channel to use by in-memory and ZIP file systems.
* Fake file channel to use by in-memory and ZIP file systems.
*/
*/
public
class
FakeFileChannel
extends
FileChannel
{
public
class
FakeFileChannel
extends
FileChannel
{
/**
* No need to allocate these, they have no state
*/
public
static
final
FakeFileChannel
INSTANCE
=
new
FakeFileChannel
();
private
FakeFileChannel
()
{}
@Override
@Override
protected
void
implCloseChannel
()
throws
IOException
{
protected
void
implCloseChannel
()
throws
IOException
{
throw
new
IOException
();
throw
new
IOException
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathMem.java
浏览文件 @
6fc65dc4
...
@@ -19,7 +19,6 @@ import java.util.List;
...
@@ -19,7 +19,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.compress.CompressLZF
;
import
org.h2.compress.CompressLZF
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
...
@@ -390,7 +389,7 @@ class FileMem extends FileBase {
...
@@ -390,7 +389,7 @@ class FileMem extends FileBase {
}
}
}
}
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
@Override
public
boolean
isValid
()
{
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathNioMem.java
浏览文件 @
6fc65dc4
...
@@ -19,7 +19,6 @@ import java.util.Map;
...
@@ -19,7 +19,6 @@ import java.util.Map;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.compress.CompressLZF
;
import
org.h2.compress.CompressLZF
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
...
@@ -385,7 +384,7 @@ class FileNioMem extends FileBase {
...
@@ -385,7 +384,7 @@ class FileNioMem extends FileBase {
}
}
}
}
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
@Override
public
boolean
isValid
()
{
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathZip.java
浏览文件 @
6fc65dc4
...
@@ -16,7 +16,6 @@ import java.util.ArrayList;
...
@@ -16,7 +16,6 @@ import java.util.ArrayList;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipFile
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
...
@@ -354,7 +353,7 @@ class FileZip extends FileBase {
...
@@ -354,7 +353,7 @@ class FileZip extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
if
(
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
@Override
public
boolean
isValid
()
{
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/fs/FilePathZip2.java
浏览文件 @
6fc65dc4
...
@@ -15,7 +15,6 @@ import java.nio.channels.FileLock;
...
@@ -15,7 +15,6 @@ import java.nio.channels.FileLock;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
java.util.zip.ZipInputStream
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FakeFileChannel
;
import
org.h2.store.fs.FakeFileChannel
;
...
@@ -427,7 +426,7 @@ class FileZip2 extends FileBase {
...
@@ -427,7 +426,7 @@ class FileZip2 extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
if
(
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
@Override
public
boolean
isValid
()
{
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论