Package org.apache.cassandra.io.util
Class ChannelProxy
java.lang.Object
org.apache.cassandra.utils.concurrent.SharedCloseableImpl
org.apache.cassandra.io.util.ChannelProxy
- All Implemented Interfaces:
AutoCloseable,SharedCloseable
A proxy of a FileChannel that:
- implements reference counting
- exports only thread safe FileChannel operations
- wraps IO exceptions into runtime exceptions
Tested by RandomAccessReaderTest.
-
Constructor Summary
ConstructorsConstructorDescriptionChannelProxy(String path) ChannelProxy(ChannelProxy copy) ChannelProxy(File file) ChannelProxy(File file, FileChannel channel) -
Method Summary
Modifier and TypeMethodDescriptionfile()filePath()intmap(FileChannel.MapMode mode, long position, long size) final ChannelProxysharedCopy()can not be used if thread will be interruped, as the backing channel will be closed.static FileChannelopenChannel(File file) intread(ByteBuffer buffer, long position) longsize()toString()longtransferTo(long position, long count, WritableByteChannel target) Methods inherited from class org.apache.cassandra.utils.concurrent.SharedCloseableImpl
addTo, close, close, isCleanedUp
-
Constructor Details
-
ChannelProxy
-
ChannelProxy
-
ChannelProxy
-
ChannelProxy
-
-
Method Details
-
openChannel
-
newChannel
sharedCopy()can not be used if thread will be interruped, as the backing channel will be closed.- Returns:
- a new channel instance
-
filePath
-
file
-
read
-
transferTo
-
map
-
size
public long size() -
getFileDescriptor
public int getFileDescriptor() -
toString
-