|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread com.isti.util.IstiThread com.isti.util.IstiNotifyThread com.isti.util.FileMonPollingThread
public class FileMonPollingThread
Class FileMonPollingThread defines a thread for monitoring a file via a 'FileDataMonitor' object.
Nested Class Summary | |
---|---|
static interface |
FileMonPollingThread.FileDataCallBack
Interface FileDataCallBack defines a call-back method to be invoked when new file data is available. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static byte[] |
ERROR_ARRAY
Empty array used to indicate error. |
protected int |
fileAccessTimeOutMs
|
protected FileMonPollingThread.FileDataCallBack |
fileDataCallBackObj
|
protected FileDataMonitor |
fileDataMonitorObj
|
protected boolean |
forceFileReadFlag
|
protected boolean |
indRecoveryFlag
|
protected long |
maxReadBytesLimit
|
protected int |
pollingIntervalMs
|
Fields inherited from class com.isti.util.IstiThread |
---|
DEFAULT_TERMINATE_WAIT_TIME, terminateFlag |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
FileMonPollingThread(java.lang.String fNameStr,
int pollingIntervalMs,
int fileAccessTimeOutMs,
long maxReadBytesLimit,
boolean indRecoveryFlag,
FileMonPollingThread.FileDataCallBack fileDataCallBackObj)
Creates a thread for monitoring a file via a 'FileDataMonitor' object. |
|
FileMonPollingThread(java.lang.String fNameStr,
int pollingIntervalMs,
int fileAccessTimeOutMs,
long maxReadBytesLimit,
FileMonPollingThread.FileDataCallBack fileDataCallBackObj)
Creates a thread for monitoring a file via a 'FileDataMonitor' object. |
Method Summary | |
---|---|
byte[] |
checkReadFileData()
Checks if the file has been modified and returns its contents if so. |
byte[] |
checkReadFileData(boolean forceFileReadFlag)
Checks if the file has been modified and returns its contents if so. |
void |
fireForceFileRead()
Fires a forced read of the file by the monitoring thread, as if the file's last-modified time had changed. |
boolean |
getErrorMessageFlag()
Returns the status of the error message. |
java.lang.String |
getErrorMessageString()
Returns the current error message (if any). |
FileDataMonitor |
getFileDataMonitorObj()
Returns the 'FileDataMonitor' object used by this object. |
void |
run()
Executing method for file-monitoring thread. |
Methods inherited from class com.isti.util.IstiNotifyThread |
---|
sleep, terminate |
Methods inherited from class com.isti.util.IstiThread |
---|
clearThreadWaitNotifyFlag, isTerminated, nextThreadNum, notifyThread, start, terminate, waitForNotify, waitForNotify, waitForTerminate, waitForTerminate, wasStarted |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte[] ERROR_ARRAY
protected final FileDataMonitor fileDataMonitorObj
protected final int pollingIntervalMs
protected final int fileAccessTimeOutMs
protected final long maxReadBytesLimit
protected final boolean indRecoveryFlag
protected final FileMonPollingThread.FileDataCallBack fileDataCallBackObj
protected boolean forceFileReadFlag
Constructor Detail |
---|
public FileMonPollingThread(java.lang.String fNameStr, int pollingIntervalMs, int fileAccessTimeOutMs, long maxReadBytesLimit, boolean indRecoveryFlag, FileMonPollingThread.FileDataCallBack fileDataCallBackObj)
fNameStr
- name of input file to be read and monitored.pollingIntervalMs
- number of milliseconds to wait between
polls of the input file.fileAccessTimeOutMs
- timeout value for file access, or 0 for
infinite.maxReadBytesLimit
- maximum number of bytes to read from file,
or 0 for no limit.indRecoveryFlag
- if true then the call-back method will be
invoked with (true,null) if the previous file-access attempt failed
and the current attempt succeeded and no change in the file
last-modified time was detected.fileDataCallBackObj
- call-back object to be invoked when changes
in the file data are detected.public FileMonPollingThread(java.lang.String fNameStr, int pollingIntervalMs, int fileAccessTimeOutMs, long maxReadBytesLimit, FileMonPollingThread.FileDataCallBack fileDataCallBackObj)
fNameStr
- name of input file to be read and monitored.pollingIntervalMs
- number of milliseconds to wait between
polls of the input file.fileAccessTimeOutMs
- timeout value for file access, or 0 for
infinite.maxReadBytesLimit
- maximum number of bytes to read from file,
or 0 for no limit.fileDataCallBackObj
- call-back object to be invoked when changes
in the file data are detected.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void fireForceFileRead()
public byte[] checkReadFileData(boolean forceFileReadFlag)
forceFileReadFlag
- true to force reading of file data; false
to only read file data if file-modified time changed.
public byte[] checkReadFileData()
public FileDataMonitor getFileDataMonitorObj()
public boolean getErrorMessageFlag()
public java.lang.String getErrorMessageString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |