|
xmlBlaster 1.5.1 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.recorder.file.FileIO
This is the generic interface to the harddisk.
It recovers on restart as the current situation is stored as well. To use this, you supply an implementation of Performance is on a standard harddisk and 600 MHz intel server:
FileIOTest
Field Summary | |
private long |
currReadPos
|
private java.io.File |
file
|
private java.lang.String |
fileName
|
private boolean |
firstLost
|
private boolean |
firstUnread
|
private Global |
glob
|
private long |
lastReadPos
|
private static java.util.logging.Logger |
log
|
private long |
LOST_POS
|
private long |
maxEntries
|
private java.lang.String |
ME
|
private int |
mode
|
private int |
modeDiscard
|
private int |
modeDiscardOldest
|
private int |
modeException
|
private long |
numFileDeleteLost
Remember number of lost data when file was killed by somebody |
private long |
numLost
|
private long |
numUnread
|
private java.io.RandomAccessFile |
ra
|
private long |
UNREAD_POS
|
private I_UserDataHandler |
userDataHandler
|
private boolean |
useSync
|
Constructor Summary | |
FileIO(Global glob,
java.lang.String fileName,
I_UserDataHandler userDataHandler,
long maxEntries,
boolean useSync)
|
Method Summary | |
void |
destroy()
Destroy data |
long |
getCurrReadPos()
Read the first 8 bytes contain the offset to data to be read |
long |
getNumFileDeleteLost()
Returns the number of lost data objects when the file was deleted by somebody. |
long |
getNumLost()
Counter for lost messages in 'discard' or 'discardOldest' mode |
long |
getNumUnread()
The number of unread data entities. |
void |
initialize()
Initializes on first startup or reloads an existing file. |
java.io.File |
mkfile(java.lang.String fullName)
Creates recursive all directories, assuming file name is the last part of the path |
java.lang.Object |
readNext(boolean autoCommit)
You can call readNext(false) and need to commit when you have processed the retrieved data successully with saveCurrReadPos(). |
void |
saveCurrReadPos()
Write the first 8 bytes containing the offset to data to be read |
void |
setModeDiscard()
Throw the message away if queue is full - the message is silently lost! |
void |
setModeDiscardOldest()
Throw the oldest message away if queue is full - the message is silently lost! |
void |
setModeException()
Default you get an Exception if queue is full |
void |
shutdown()
Don't loose data |
boolean |
undo()
Undo the last read, not that this is not thread save! Only one single undo is supported |
void |
writeNext(java.lang.Object data)
Write more data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.util.logging.Logger log
private final java.lang.String ME
private final Global glob
private long currReadPos
private long lastReadPos
private java.io.File file
private java.io.RandomAccessFile ra
private long numUnread
private boolean firstUnread
private final long UNREAD_POS
private boolean firstLost
private long numLost
private final long LOST_POS
private long numFileDeleteLost
private boolean useSync
private final I_UserDataHandler userDataHandler
private java.lang.String fileName
private long maxEntries
private final int modeException
private final int modeDiscardOldest
private final int modeDiscard
private int mode
Constructor Detail |
public FileIO(Global glob, java.lang.String fileName, I_UserDataHandler userDataHandler, long maxEntries, boolean useSync) throws java.io.IOException
maxEntries
- < 0 sets it to unlimiteduserDataHandler
- Your implementation of your data format marshallingMethod Detail |
public void initialize() throws java.io.IOException
java.io.IOException
public java.io.File mkfile(java.lang.String fullName) throws java.io.IOException
java.io.IOException
public java.lang.Object readNext(boolean autoCommit) throws java.io.IOException, XmlBlasterException
XmlBlasterException
- />
"FileRecorder.FileLost" If file disappeared, you can proceed
Of an XmlBlasterExeption from the user data handler
java.io.IOException
XmlBlasterException
public boolean undo()
public void writeNext(java.lang.Object data) throws java.io.IOException, XmlBlasterException
XmlBlasterException
- />
"ErrorCode.FileRecorder.FileLost" If file disappeared, we create a new and store the message
"ErrorCode.RESOURCE_OVERFLOW_QUEUE_ENTRIES" Maximum size reached in Exception mode
Of an XmlBlasterExeption from the user data handler
java.io.IOException
XmlBlasterException
public final void saveCurrReadPos() throws java.io.IOException
java.io.IOException
public final long getCurrReadPos() throws java.io.IOException
java.io.IOException
public final long getNumUnread()
public long getNumLost()
public final long getNumFileDeleteLost()
public void setModeDiscard()
public void setModeDiscardOldest()
public void setModeException()
public void shutdown()
public void destroy()
|
xmlBlaster 1.5.1 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |