public class NarReader extends java.lang.Object implements StateBufferSaveable, Callback, CheckpointUserSourceIfc
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
InputFileProp |
static java.lang.String |
NARDELETE |
static java.lang.String |
NAROffsetProp |
static java.lang.String |
NARREAD |
static java.lang.String |
NARsInFileProp |
Constructor and Description |
---|
NarReader(java.io.File inputdir,
LoggerIfc inLogger)
Creates a NarReader without backup capabilities.
|
NarReader(java.io.File inputdir,
LoggerIfc inLogger,
DCNode node)
Creates a NarReader with state recovery capabilities, but without backup
capabilities.
|
NarReader(java.io.File inputdir,
LoggerIfc inLogger,
java.io.File backupdir)
Creates a NarReader with backup capabilities.
|
NarReader(java.io.File inputdir,
LoggerIfc inLogger,
java.io.File backupdir,
DCNode node,
CheckpointManager cpm,
InputStatisticsMonitorIfc inCount,
boolean fileLevelTrans)
Creates a NarReader with backup capabilities, and state recovery
capabilities.
|
NarReader(java.io.File inputdir,
LoggerIfc inLogger,
java.io.File backupdir,
DCNode node,
CheckpointManager cpm,
InputStatisticsMonitorIfc inCount,
boolean isMultiThreaded,
int threadCount,
boolean mtOrderChecked,
int currThread,
boolean fileLevelTrans)
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.
|
void |
clearCheckpointData() |
void |
continueFromCheckpoint() |
void |
flushCheckpoint(BaseCheckpointData cp) |
BaseCheckpointData |
generateEmptyCheckpointData() |
BaseCheckpointData |
getCheckpointData() |
java.lang.String |
getIdentifier() |
protected void |
getLastInputInfo()
Check and get the private checkpoint data.
|
void |
handleRejectOfFile() |
boolean |
isBulkDataAvailable()
Returns whether there are more files available for processing.
|
boolean |
isDataAvailable()
Returns whether there are more records available for processing.
|
boolean |
isEndOfFile()
Method indicates if the file is opened for file level transaction
|
boolean |
isFileDataAvailable() |
boolean |
isFileOpen()
Method indicates if the file is opened for file level transaction
|
boolean |
isStartOfFile()
Method indicates if the file is opened for file level transaction
|
java.lang.String |
openInputFile() |
void |
pauseForCheckpoint() |
NAR[] |
readAllNARs() |
NAR |
readNAR()
Returns the next NAR.
|
NAR[] |
readNARs() |
boolean |
rejectFile()
Method to reject input file
|
void |
restoreCheckpoint(BaseCheckpointData bcp) |
void |
restoreState(StateBuffer buffer)
Restores the runtime state of the Reader from a StateBuffer.
|
protected void |
saveCurrentInputInfo()
Re-save checkpoint data into private file in scratch directory, for
proper recovery at next startup.
|
void |
saveState(StateBuffer buffer)
Saves the state of the NarReader to a buffer.
|
boolean |
setFilesForFileLevelTransaction() |
void |
shutdown()
Tells the NarReader it is time to shut down.
|
public static final java.lang.String NARREAD
public static final java.lang.String NARDELETE
public static final java.lang.String InputFileProp
public static final java.lang.String NAROffsetProp
public static final java.lang.String NARsInFileProp
public NarReader(java.io.File inputdir, LoggerIfc inLogger)
inputdir
- Node input directoryinLogger
- Node loggerpublic NarReader(java.io.File inputdir, LoggerIfc inLogger, java.io.File backupdir)
inputdir
- Node input directoryinLogger
- Node loggerbackupdir
- Node backup directorypublic NarReader(java.io.File inputdir, LoggerIfc inLogger, DCNode node)
inputdir
- Node input directoryinLogger
- Node loggernode
- Used to signal state backups.public NarReader(java.io.File inputdir, LoggerIfc inLogger, java.io.File backupdir, DCNode node, CheckpointManager cpm, InputStatisticsMonitorIfc inCount, boolean fileLevelTrans)
inputdir
- Node input directoryinLogger
- Node loggerbackupdir
- Node backup directorynode
- Used to signal state backups.public NarReader(java.io.File inputdir, LoggerIfc inLogger, java.io.File backupdir, DCNode node, CheckpointManager cpm, InputStatisticsMonitorIfc inCount, boolean isMultiThreaded, int threadCount, boolean mtOrderChecked, int currThread, boolean fileLevelTrans)
inputdir
- Node input directoryinLogger
- Node loggerbackupdir
- Node backup directorynode
- Used to signal state backups.isMultiThreaded
- Used to signal multi threaded node.threadCount
- Total number of threads.currThread
- Current thread.public void shutdown()
public NAR readNAR()
public NAR[] readNARs()
public void handleRejectOfFile()
public boolean setFilesForFileLevelTransaction()
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 isFileOpen() throws java.lang.Exception
java.lang.Exception
public boolean isStartOfFile() throws java.lang.Exception
java.lang.Exception
public boolean rejectFile() throws java.lang.Exception
java.lang.Exception
public boolean isEndOfFile() throws java.lang.Exception
java.lang.Exception
public boolean isDataAvailable()
true
, if data is availablepublic boolean isFileDataAvailable() throws java.lang.Exception
java.lang.Exception
public java.lang.String openInputFile() throws java.lang.Exception
java.lang.Exception
public boolean isBulkDataAvailable()
true
, if data is availablepublic NAR[] readAllNARs()
public java.lang.String getIdentifier()
getIdentifier
in interface CheckpointUserIfc
public BaseCheckpointData generateEmptyCheckpointData()
generateEmptyCheckpointData
in interface CheckpointUserIfc
public void pauseForCheckpoint()
pauseForCheckpoint
in interface CheckpointUserSourceIfc
public BaseCheckpointData getCheckpointData()
getCheckpointData
in interface CheckpointUserIfc
public void clearCheckpointData()
clearCheckpointData
in interface CheckpointUserIfc
public void continueFromCheckpoint()
continueFromCheckpoint
in interface CheckpointUserSourceIfc
public void flushCheckpoint(BaseCheckpointData cp)
flushCheckpoint
in interface CheckpointUserIfc
public void restoreCheckpoint(BaseCheckpointData bcp)
restoreCheckpoint
in interface CheckpointUserIfc
protected void saveCurrentInputInfo()
protected void getLastInputInfo()