public class NarWriter extends java.lang.Object implements java.awt.event.ActionListener, StateBufferSaveable, StateFreezable, Callback, CheckpointUserIfc
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NARWRITE |
| Constructor and Description |
|---|
NarWriter(java.io.File outputdir,
java.io.File scratchdir,
ConfigIfc config,
LoggerIfc logger,
java.lang.String nodeid,
java.lang.String chan,
FilenameGenerator filenameGen,
DCNode node,
int externalId,
CheckpointManager checkpointMgr,
boolean fileLevelTrans)
Creates a NarWriter object with the given parameters.
|
NarWriter(java.io.File outputdir,
java.io.File scratchdir,
ConfigIfc config,
LoggerIfc logger,
java.lang.String nodeid,
java.lang.String chan,
FilenameGenerator filenameGen,
DCNode node,
int externalId,
CheckpointManager checkpointMgr,
boolean isMultiThreaded,
int threadCount,
int currThread,
boolean isOrdered,
boolean fileLevelTrans)
Creates a NarWriter object with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
This method is called by the NarWriter timer.
|
void |
callback()
This callback is used only when the saveState() call is made by this
Object.
|
void |
clearCheckpointData() |
void |
createNewCacheFile() |
void |
flushCheckpoint(BaseCheckpointData cp) |
void |
freezeState(Callback freezeCallback)
Used by another Thread to request the timer to freeze, and halt its
processing.
|
BaseCheckpointData |
generateEmptyCheckpointData() |
java.io.File |
getActiveOutputFile()
Returns the current active output cache file.
|
BaseCheckpointData |
getCheckpointData() |
java.lang.String |
getIdentifier() |
int |
getRecordCount()
Returns the number of records written to the current cache file.
|
int |
getTotalRecordCount()
Returns the total number of records written by this writer.
|
boolean |
moveCacheToReadyToOut(boolean initNew) |
boolean |
moveToArchive()
This method renames the currently active NAR cache file to an archive
file.
|
void |
moveToReadyToOut(boolean initNew) |
boolean |
processEndOfFileData() |
boolean |
processRejectFile() |
boolean |
processStartOfFileData(java.lang.String originalFileName) |
void |
restoreCheckpoint(BaseCheckpointData bcp) |
void |
restoreState(StateBuffer buffer)
Restores the state of the NarWriter from the state buffer.
|
void |
saveState(StateBuffer buffer)
Saves the state of the NarWriter to the state buffer.
|
void |
shutdown()
Shuts down the NarWriter in a graceful manner.
|
void |
start()
Starts the NarWriter.
|
void |
unfreezeState()
Used by another Thread to request the timer to unfreeze, and resume its
processing.
|
boolean |
writeNAR(NAR osar)
The writeNAR() method stores an NAR in the current cache file.
|
public NarWriter(java.io.File outputdir,
java.io.File scratchdir,
ConfigIfc config,
LoggerIfc logger,
java.lang.String nodeid,
java.lang.String chan,
FilenameGenerator filenameGen,
DCNode node,
int externalId,
CheckpointManager checkpointMgr,
boolean fileLevelTrans)
outputdir - Node output dirscratchdir - Node scratch dirconfig - Node config filelogger - Node loggernodeid - Node's IDchan - Channel ValuefilenameGen - Filename generatorfileLevelTrans - Used to indicate if the node is used in file level transactionpublic NarWriter(java.io.File outputdir,
java.io.File scratchdir,
ConfigIfc config,
LoggerIfc logger,
java.lang.String nodeid,
java.lang.String chan,
FilenameGenerator filenameGen,
DCNode node,
int externalId,
CheckpointManager checkpointMgr,
boolean isMultiThreaded,
int threadCount,
int currThread,
boolean isOrdered,
boolean fileLevelTrans)
outputdir - Node output dirscratchdir - Node scratch dirconfig - Node config filelogger - Node loggernodeid - Node's IDchan - Channel ValuefilenameGen - Filename generatorisMultiThreaded - Used to signal multi threaded node.threadCount - Total number of threads.currThread - Current thread.isOrdered - Used to check if ordering is required.fileLevelTrans - Used to indicate if the node is used in file level transactionpublic void start()
public void shutdown()
public boolean writeNAR(NAR osar)
osar - NAR to writepublic boolean moveToArchive()
public boolean moveCacheToReadyToOut(boolean initNew)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic void callback()
public java.io.File getActiveOutputFile()
public int getRecordCount()
public int getTotalRecordCount()
public void saveState(StateBuffer buffer)
saveState in interface StateBufferSaveablebuffer - State Buffer objectpublic void restoreState(StateBuffer buffer)
restoreState in interface StateBufferSaveablebuffer - State Buffer objectpublic void freezeState(Callback freezeCallback)
freezeState in interface StateFreezablefreezeCallback - Notification Object. When the timer has been frozen, use this
Object to notify the caller.public void unfreezeState()
unfreezeState in interface StateFreezablepublic boolean processStartOfFileData(java.lang.String originalFileName)
public boolean processEndOfFileData()
public boolean processRejectFile()
public java.lang.String getIdentifier()
getIdentifier in interface CheckpointUserIfcpublic BaseCheckpointData generateEmptyCheckpointData()
generateEmptyCheckpointData in interface CheckpointUserIfcpublic BaseCheckpointData getCheckpointData()
getCheckpointData in interface CheckpointUserIfcpublic void clearCheckpointData()
clearCheckpointData in interface CheckpointUserIfcpublic void flushCheckpoint(BaseCheckpointData cp)
flushCheckpoint in interface CheckpointUserIfcpublic void restoreCheckpoint(BaseCheckpointData bcp)
restoreCheckpoint in interface CheckpointUserIfcpublic void moveToReadyToOut(boolean initNew)
public void createNewCacheFile()