public class AIOSequentialFile extends AbstractSequentialFile
AbstractSequentialFile.LocalBufferObserverdirectory, factory, file, fileSize, position, timedBuffer, timedBufferObserver| Constructor and Description |
|---|
AIOSequentialFile(AIOSequentialFileFactory factory,
int bufferSize,
long bufferTimeoutMilliseconds,
File directory,
String fileName,
Executor writerExecutor) |
| Modifier and Type | Method and Description |
|---|---|
void |
blockingWriteDirect(ByteBuffer bytes,
boolean sync,
boolean releaseBuffer)
Write directly to the file without using any intermediate buffer and wait completion.
If releaseBuffer is true the provided bytes should be released
through SequentialFileFactory.releaseBuffer(ByteBuffer), if supported. |
int |
calculateBlockStart(int position) |
SequentialFile |
cloneFile() |
void |
close() |
void |
close(boolean waitSync,
boolean blockOnWait)
When closing a file from a finalize block, you cant wait on syncs or anything like that.
|
void |
fill(int size) |
boolean |
isOpen() |
boolean |
isPending() |
ByteBuffer |
map(int position,
long size) |
void |
open() |
void |
open(int maxIO,
boolean useExecutor)
The maximum number of simultaneous writes accepted
|
int |
read(ByteBuffer bytes) |
int |
read(ByteBuffer bytes,
IOCallback callback) |
long |
size() |
void |
sync() |
String |
toString() |
void |
waitNotPending() |
void |
writeDirect(ByteBuffer bytes,
boolean sync)
Write directly to the file without using intermediate any buffer
|
void |
writeDirect(ByteBuffer bytes,
boolean sync,
IOCallback callback)
Note: Parameter sync is not used on AIO
|
copyTo, createTimedBufferObserver, delete, exists, fits, getFile, getFileName, getJavaFile, newBuffer, position, position, renameTo, setTimedBuffer, write, write, write, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitafterComplete, appendTopublic AIOSequentialFile(AIOSequentialFileFactory factory, int bufferSize, long bufferTimeoutMilliseconds, File directory, String fileName, Executor writerExecutor)
public ByteBuffer map(int position, long size) throws IOException
IOExceptionpublic boolean isOpen()
public int calculateBlockStart(int position)
public SequentialFile cloneFile()
public void close()
throws IOException,
InterruptedException,
ActiveMQException
close in interface SequentialFileclose in class AbstractSequentialFileIOException - we declare throwing IOException because sub-classes need to do itInterruptedExceptionActiveMQExceptionpublic boolean isPending()
public void waitNotPending()
public void close(boolean waitSync,
boolean blockOnWait)
throws IOException,
InterruptedException,
ActiveMQException
SequentialFilepublic void open(int maxIO,
boolean useExecutor)
throws ActiveMQException
SequentialFileActiveMQExceptionpublic int read(ByteBuffer bytes, IOCallback callback) throws ActiveMQException
bytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).ActiveMQExceptionpublic int read(ByteBuffer bytes) throws Exception
bytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).Exceptionpublic void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
SequentialFilebytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).Exceptionpublic void blockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer) throws Exception
SequentialFilereleaseBuffer is true the provided bytes should be released
through SequentialFileFactory.releaseBuffer(ByteBuffer), if supported.bytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). If releaseBuffer is true use a buffer from
SequentialFileFactory.newBuffer(int), SequentialFileFactory.allocateDirectBuffer(int)
otherwise.sync - if true will durable flush the written data on the file, false otherwisereleaseBuffer - if true will release the buffer, false otherwiseExceptionpublic void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback)
bytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).public void sync()
Copyright © 2021 The Apache Software Foundation. All rights reserved.