public class AIOSequentialFile extends AbstractSequentialFile implements IOExceptionListener
AbstractSequentialFile.LocalBufferObserverfactory, fileSize, position, timedBuffer, timedBufferObserver, writerExecutor| Constructor and Description |
|---|
AIOSequentialFile(SequentialFileFactory factory,
int bufferSize,
long bufferTimeoutMilliseconds,
String directory,
String fileName,
int maxIO,
BufferCallback bufferCallback,
Executor writerExecutor,
Executor pollerExecutor) |
| Modifier and Type | Method and Description |
|---|---|
int |
calculateBlockStart(int position) |
SequentialFile |
cloneFile() |
void |
close() |
void |
fill(int position,
int size,
byte fillCharacter) |
int |
getAlignment() |
boolean |
isOpen() |
protected ByteBuffer |
newBuffer(int size,
int limit) |
void |
onIOException(Exception code,
String message) |
void |
open() |
void |
open(int maxIO,
boolean useExecutor)
The maximum number of simultaneous writes accepted
|
int |
read(ByteBuffer bytes) |
int |
read(ByteBuffer bytes,
IOAsyncTask callback) |
void |
setBufferCallback(BufferCallback callback) |
long |
size() |
void |
sync() |
String |
toString() |
void |
waitForClose() |
void |
writeDirect(ByteBuffer bytes,
boolean sync)
Write directly to the file without using any buffer
|
void |
writeDirect(ByteBuffer bytes,
boolean sync,
IOAsyncTask callback)
Write directly to the file without using any buffer
|
void |
writeInternal(ByteBuffer bytes)
Write directly to the file.
|
copyTo, delete, exists, fits, getFile, getFileName, getJavaFile, position, position, renameTo, setTimedBuffer, write, write, write, writepublic AIOSequentialFile(SequentialFileFactory factory, int bufferSize, long bufferTimeoutMilliseconds, String directory, String fileName, int maxIO, BufferCallback bufferCallback, Executor writerExecutor, Executor pollerExecutor)
public boolean isOpen()
isOpen in interface SequentialFilepublic int getAlignment()
getAlignment in interface SequentialFilepublic int calculateBlockStart(int position)
calculateBlockStart in interface SequentialFilepublic SequentialFile cloneFile()
cloneFile in interface SequentialFilepublic void close()
throws IOException,
InterruptedException,
HornetQException
close in interface SequentialFileclose in class AbstractSequentialFileIOException - we declare throwing IOException because sub-classes need to do itInterruptedExceptionHornetQExceptionpublic void waitForClose()
throws Exception
waitForClose in interface SequentialFileExceptionpublic void fill(int position,
int size,
byte fillCharacter)
throws Exception
fill in interface SequentialFileExceptionpublic void open()
throws Exception
open in interface SequentialFileExceptionpublic void open(int maxIO,
boolean useExecutor)
throws HornetQException
SequentialFileopen in interface SequentialFileHornetQExceptionpublic void setBufferCallback(BufferCallback callback)
public int read(ByteBuffer bytes, IOAsyncTask callback) throws HornetQException
read in interface 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).HornetQExceptionpublic int read(ByteBuffer bytes) throws Exception
read in interface 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 sync()
sync in interface SequentialFilepublic long size()
throws Exception
size in interface SequentialFileExceptionpublic void onIOException(Exception code, String message)
onIOException in interface IOExceptionListenerpublic void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
SequentialFilewriteDirect in interface 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 writeDirect(ByteBuffer bytes, boolean sync, IOAsyncTask callback)
SequentialFilewriteDirect in interface SequentialFilesync - Not used on AIObytes - 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 writeInternal(ByteBuffer bytes) throws HornetQException
SequentialFilewriteInternal in interface 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).HornetQExceptionprotected ByteBuffer newBuffer(int size, int limit)
newBuffer in class AbstractSequentialFileCopyright © 2016 JBoss, a division of Red Hat. All rights reserved.