public class MXNarReader extends java.lang.Object implements StateBufferSaveable, Callback
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
InputFileProp |
static java.lang.String |
NAROffsetProp |
static java.lang.String |
NARsInFileProp |
Constructor and Description |
---|
MXNarReader(java.io.File inputdir,
LoggerIfc inLogger,
java.io.File backupdir,
DCNode node,
CheckpointManager cpm,
InputStatisticsMonitorIfc inCount,
MXNarInputTracker inTracker)
Creates a NarReader with backup capabilities, and state
recovery capabilities.
|
Modifier and Type | Method and Description |
---|---|
void |
callback()
This callback is made when the NarReader's call to saveState()
has successfully saved the state of the system to disk.
|
boolean |
checkInput()
This method checks for an empty input directory.
|
protected boolean |
deleteOrRemoveFiles()
This implmentation is not thread-safe.
|
boolean |
isDataAvailable()
Returns whether there are more records available for processing.
|
NAR |
readNAR()
Returns the next NAR.
|
NAR[] |
readNARs() |
boolean |
removeInputFile(java.io.File removeFile) |
void |
restoreState(StateBuffer buffer)
Restores the runtime state of the Reader from a StateBuffer.
|
void |
saveState(StateBuffer buffer)
Saves the state of the NarReader to a buffer.
|
void |
shutdown()
Tells the NarReader it is time to shut down.
|
public static final java.lang.String InputFileProp
public static final java.lang.String NAROffsetProp
public static final java.lang.String NARsInFileProp
public MXNarReader(java.io.File inputdir, LoggerIfc inLogger, java.io.File backupdir, DCNode node, CheckpointManager cpm, InputStatisticsMonitorIfc inCount, MXNarInputTracker inTracker)
inputdir
- Node input directoryinLogger
- Node loggerbackupdir
- Node backup directorynode
- Used to signal state backups.public void shutdown()
public NAR readNAR()
public NAR[] readNARs()
public boolean removeInputFile(java.io.File removeFile)
protected boolean deleteOrRemoveFiles()
removeFile
- public void callback()
public void saveState(StateBuffer buffer)
saveState
in interface StateBufferSaveable
buffer
- Buffer containing state datapublic void restoreState(StateBuffer buffer) throws StateException
restoreState
in interface StateBufferSaveable
buffer
- Buffer, holding the Reader dataStateException
public boolean checkInput()
public boolean isDataAvailable()
true
, if data is available