Package org.h2.store.fs.retry
Class FileRetryOnInterrupt
java.lang.Object
java.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.FileChannel
org.h2.store.fs.FileBase
org.h2.store.fs.retry.FileRetryOnInterrupt
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,GatheringByteChannel
,InterruptibleChannel
,ReadableByteChannel
,ScatteringByteChannel
,SeekableByteChannel
,WritableByteChannel
A file object that re-opens and re-tries the operation if the file was
closed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
A wrapped file lock.Nested classes/interfaces inherited from class java.nio.channels.FileChannel
FileChannel.MapMode
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
force
(boolean metaData) void
private void
open()
long
position()
position
(long pos) int
read
(ByteBuffer dst) int
read
(ByteBuffer dst, long position) private void
reLock()
private void
reopen
(int i, IOException e) long
size()
toString()
truncate
(long newLength) tryLock
(long position, long size, boolean shared) int
write
(ByteBuffer src) int
write
(ByteBuffer src, long position) Methods inherited from class org.h2.store.fs.FileBase
lock, map, read, transferFrom, transferTo, write
Methods inherited from class java.nio.channels.FileChannel
lock, map, open, open, read, tryLock, write
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
Field Details
-
fileName
-
mode
-
channel
-
lock
-
-
Constructor Details
-
FileRetryOnInterrupt
FileRetryOnInterrupt(String fileName, String mode) throws IOException - Throws:
IOException
-
-
Method Details
-
open
- Throws:
IOException
-
reopen
- Throws:
IOException
-
reLock
- Throws:
IOException
-
implCloseChannel
- Overrides:
implCloseChannel
in classFileBase
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Specified by:
position
in classFileChannel
- Throws:
IOException
-
size
- Specified by:
size
in interfaceSeekableByteChannel
- Specified by:
size
in classFileChannel
- Throws:
IOException
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Specified by:
read
in classFileChannel
- Throws:
IOException
-
read
- Overrides:
read
in classFileBase
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Specified by:
position
in classFileChannel
- Throws:
IOException
-
truncate
- Specified by:
truncate
in interfaceSeekableByteChannel
- Specified by:
truncate
in classFileChannel
- Throws:
IOException
-
force
- Overrides:
force
in classFileBase
- Throws:
IOException
-
write
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Specified by:
write
in classFileChannel
- Throws:
IOException
-
write
- Overrides:
write
in classFileBase
- Throws:
IOException
-
tryLock
- Overrides:
tryLock
in classFileBase
- Throws:
IOException
-
toString
-