public class AIOSequentialFile extends AbstractSequentialFile implements IOExceptionListener
AbstractSequentialFile.LocalBufferObserver
factory, 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, write
public 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 SequentialFile
public int getAlignment()
getAlignment
in interface SequentialFile
public int calculateBlockStart(int position)
calculateBlockStart
in interface SequentialFile
public SequentialFile cloneFile()
cloneFile
in interface SequentialFile
public void close() throws IOException, InterruptedException, HornetQException
close
in interface SequentialFile
close
in class AbstractSequentialFile
IOException
- we declare throwing IOException because sub-classes need to do itInterruptedException
HornetQException
public void waitForClose() throws Exception
waitForClose
in interface SequentialFile
Exception
public void fill(int position, int size, byte fillCharacter) throws Exception
fill
in interface SequentialFile
Exception
public void open() throws Exception
open
in interface SequentialFile
Exception
public void open(int maxIO, boolean useExecutor) throws HornetQException
SequentialFile
open
in interface SequentialFile
HornetQException
public void setBufferCallback(BufferCallback callback)
public int read(ByteBuffer bytes, IOAsyncTask callback) throws HornetQException
read
in interface SequentialFile
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)
.HornetQException
public int read(ByteBuffer bytes) throws Exception
read
in interface SequentialFile
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)
.Exception
public void sync()
sync
in interface SequentialFile
public long size() throws Exception
size
in interface SequentialFile
Exception
public void onIOException(Exception code, String message)
onIOException
in interface IOExceptionListener
public void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
SequentialFile
writeDirect
in interface SequentialFile
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)
.Exception
public void writeDirect(ByteBuffer bytes, boolean sync, IOAsyncTask callback)
SequentialFile
writeDirect
in interface SequentialFile
sync
- 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
SequentialFile
writeInternal
in interface SequentialFile
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)
.HornetQException
protected ByteBuffer newBuffer(int size, int limit)
newBuffer
in class AbstractSequentialFile
Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.