public class NIOSequentialFileFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferSize |
protected long |
bufferTimeout |
protected static int |
EXECUTOR_TIMEOUT |
protected String |
journalDir |
protected TimedBuffer |
timedBuffer |
protected ExecutorService |
writeExecutor
Asynchronous writes need to be done at another executor.
|
| Constructor and Description |
|---|
NIOSequentialFileFactory(String journalDir) |
NIOSequentialFileFactory(String journalDir,
boolean buffered) |
NIOSequentialFileFactory(String journalDir,
boolean buffered,
int bufferSize,
int bufferTimeout,
boolean logRates) |
NIOSequentialFileFactory(String journalDir,
boolean buffered,
int bufferSize,
int bufferTimeout,
boolean logRates,
IOCriticalErrorListener listener) |
NIOSequentialFileFactory(String journalDir,
boolean buffered,
IOCriticalErrorListener listener) |
NIOSequentialFileFactory(String journalDir,
IOCriticalErrorListener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
activateBuffer(SequentialFile file) |
ByteBuffer |
allocateDirectBuffer(int size)
used for cases where you need direct buffer outside of the journal context.
|
int |
calculateBlockSize(int bytes) |
void |
clearBuffer(ByteBuffer buffer) |
void |
createDirs()
Create the directory if it doesn't exist yet
|
SequentialFile |
createSequentialFile(String fileName,
int maxIO) |
void |
deactivateBuffer() |
void |
flush() |
int |
getAlignment() |
String |
getDirectory() |
boolean |
isSupportsCallbacks() |
List<String> |
listFiles(String extension)
Lists files that end with the given extension.
|
ByteBuffer |
newBuffer(int size)
Note: You need to release the buffer if is used for reading operations.
|
void |
onIOError(Exception exception,
String message,
SequentialFile file)
The SequentialFile will call this method when a disk IO Error happens during the live phase.
|
void |
releaseBuffer(ByteBuffer buffer) |
void |
releaseDirectBuffer(ByteBuffer buffer)
used for cases where you need direct buffer outside of the journal context.
|
void |
start() |
void |
stop() |
ByteBuffer |
wrapBuffer(byte[] bytes) |
protected static final int EXECUTOR_TIMEOUT
protected final String journalDir
protected final TimedBuffer timedBuffer
protected final int bufferSize
protected final long bufferTimeout
protected ExecutorService writeExecutor
public NIOSequentialFileFactory(String journalDir)
public NIOSequentialFileFactory(String journalDir, IOCriticalErrorListener listener)
public NIOSequentialFileFactory(String journalDir, boolean buffered)
public NIOSequentialFileFactory(String journalDir, boolean buffered, IOCriticalErrorListener listener)
public NIOSequentialFileFactory(String journalDir, boolean buffered, int bufferSize, int bufferTimeout, boolean logRates)
public NIOSequentialFileFactory(String journalDir, boolean buffered, int bufferSize, int bufferTimeout, boolean logRates, IOCriticalErrorListener listener)
public SequentialFile createSequentialFile(String fileName, int maxIO)
public boolean isSupportsCallbacks()
public ByteBuffer allocateDirectBuffer(int size)
SequentialFileFactorypublic void releaseDirectBuffer(ByteBuffer buffer)
SequentialFileFactorypublic ByteBuffer newBuffer(int size)
SequentialFileFactorypublic void clearBuffer(ByteBuffer buffer)
public ByteBuffer wrapBuffer(byte[] bytes)
public int getAlignment()
public int calculateBlockSize(int bytes)
public void stop()
stop in interface SequentialFileFactorypublic String getDirectory()
getDirectory in interface SequentialFileFactorypublic void start()
start in interface SequentialFileFactorypublic void onIOError(Exception exception, String message, SequentialFile file)
SequentialFileFactoryonIOError in interface SequentialFileFactorypublic void activateBuffer(SequentialFile file)
activateBuffer in interface SequentialFileFactorypublic void flush()
flush in interface SequentialFileFactorypublic void deactivateBuffer()
deactivateBuffer in interface SequentialFileFactorypublic void releaseBuffer(ByteBuffer buffer)
releaseBuffer in interface SequentialFileFactorypublic void createDirs()
throws Exception
createDirs in interface SequentialFileFactoryExceptionpublic List<String> listFiles(String extension) throws Exception
SequentialFileFactoryThis method inserts a ".' before the extension.
listFiles in interface SequentialFileFactoryExceptionCopyright © 2013 JBoss, a division of Red Hat. All rights reserved.