|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.IstiTimeObjectCache com.isti.util.IstiMessageObjectCache
Class IstiMessageObjectCache implements a message object cache. The 'removeOldObjects()' method should be called on a periodic basis to remove old objects from the cache.
Nested Class Summary | |
static class |
IstiMessageObjectCache.BasicMessageObjectEntry
Message object entry class. |
static interface |
IstiMessageObjectCache.MessageObjectEntry
Interface for message object entry. |
Nested classes inherited from class com.isti.util.IstiTimeObjectCache |
IstiTimeObjectCache.BasicTimeObjectEntry, IstiTimeObjectCache.CacheInformation, IstiTimeObjectCache.TimeObjectEntry, IstiTimeObjectCache.VectorWithCount |
Field Summary | |
protected long |
lastMsgNumSeqBreakMsgNumLogged
|
protected long |
lastMsgNumSeqBreakTime
|
protected long |
lastMsgNumTracker
|
protected java.io.FileDescriptor |
msgNumFDescObj
|
protected java.lang.String |
msgNumFileName
|
protected java.lang.Object |
msgNumFileSyncObj
|
protected java.io.RandomAccessFile |
msgNumRAFileObj
|
Fields inherited from class com.isti.util.IstiTimeObjectCache |
defaultRemoveAge, lastMsgTimeTracker, logObj, maximumObjectCount, maximumTotalDataSize, objectCache, tolerance, totalCacheDataSize, useLookupKeyFlag |
Constructor Summary | |
IstiMessageObjectCache(LogFile logObj,
long tolerance)
Constructs a time object cache. |
|
IstiMessageObjectCache(LogFile logObj,
long tolerance,
long removeAge)
Constructs a message object cache with a default remove age. |
|
IstiMessageObjectCache(LogFile logObj,
long tolerance,
long removeAge,
boolean useLookupKeyFlag)
Constructs a message object cache with a default remove age. |
|
IstiMessageObjectCache(LogFile logObj,
long tolerance,
long removeAge,
java.lang.String msgNumFileName)
Constructs a message object cache. |
|
IstiMessageObjectCache(LogFile logObj,
long tolerance,
long removeAge,
java.lang.String msgNumFileName,
boolean useLookupKeyFlag)
Constructs a message object cache. |
Method Summary | |
void |
addMessage(long timeGenerated,
java.lang.Object msgObj,
java.lang.String msgStr,
long msgNum)
Adds the message. |
void |
addMsgObjEntry(IstiMessageObjectCache.MessageObjectEntry msgObj)
Adds the message-object entry. |
void |
close()
Deallocates resources associated with the cache. |
IstiMessageObjectCache.MessageObjectEntry |
getFirstMessage()
Returns the first message object in the cache. |
IstiMessageObjectCache.MessageObjectEntry |
getLastMessage()
Returns the last message object in the cache. |
long |
getLastMsgNum()
Return the last message number. |
long |
getLastMsgNumSeqBreakTime()
Returns the time for the last detected break in the message number sequence for messages added to the cache. |
protected java.lang.String |
getLogPrefixString()
Returns the prefix to use for log output. |
protected IstiMessageObjectCache.MessageObjectEntry |
getMessage(int index)
Returns the message entry at the given index. |
IstiTimeObjectCache.VectorWithCount |
getMessages(long beginTime,
long beginMsgNum,
long endTime,
long endMsgNum)
Retrieves a copy of messages in the specified time range. |
IstiTimeObjectCache.VectorWithCount |
getMessages(long beginTime,
long beginMsgNum,
long endTime,
long endMsgNum,
int maxCount)
Retrieves a copy of messages in the specified time range. |
protected long |
getMsgTime(long msgNum)
Gets the message time for the specified message number. |
IstiTimeObjectCache.VectorWithCount |
getNewerMessages(long time,
long msgNum)
Returns a list of messages newer or equal to the specified time value or later than the specified message number. |
IstiTimeObjectCache.VectorWithCount |
getNewerMessages(long time,
long msgNum,
int maxCount)
Returns a list of messages newer or equal to the specified time value or later than the specified message number. |
IstiTimeObjectCache.VectorWithCount |
getOlderMessages(long time,
long msgNum)
Returns a list of messages older or equal to the specified time value or sooner than the specified message number. |
IstiTimeObjectCache.VectorWithCount |
getOlderMessages(long time,
long msgNum,
int maxCount)
Returns a list of messages older or equal to the specified time value or sooner than the specified message number. |
protected void |
readMsgNumFile()
Reads the last message number from the message-number file. |
protected IstiTimeObjectCache.VectorWithCount |
subListVector(long beginTime,
long beginMsgNum,
long endTime,
long endMsgNum,
int maxCount)
Retrieves a sub list of objects. |
protected void |
writeMsgNumFile()
Writes the last message number to the message-number file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected long lastMsgNumTracker
protected final java.lang.String msgNumFileName
protected java.io.RandomAccessFile msgNumRAFileObj
protected java.io.FileDescriptor msgNumFDescObj
protected final java.lang.Object msgNumFileSyncObj
protected long lastMsgNumSeqBreakTime
protected long lastMsgNumSeqBreakMsgNumLogged
Constructor Detail |
public IstiMessageObjectCache(LogFile logObj, long tolerance)
logObj
- log file object to use or null for no logging.tolerance
- number of milliseconds for time tolerance
that is used with time checkspublic IstiMessageObjectCache(LogFile logObj, long tolerance, long removeAge)
logObj
- log file object to use or null for no logging.tolerance
- number of milliseconds for time tolerance
that is used with time checksremoveAge
- number of milliseconds to keep objects in the cache
or 0 for no default.public IstiMessageObjectCache(LogFile logObj, long tolerance, long removeAge, boolean useLookupKeyFlag)
logObj
- log file object to use or null for no logging.tolerance
- number of milliseconds for time tolerance
that is used with time checksremoveAge
- number of milliseconds to keep objects in the cache
or 0 for no default.useLookupKeyFlag
- true to use the "keyStr" parameter (when
adding) as a table-lookup key (which forces cache entries to have
unique "keyStr" values).public IstiMessageObjectCache(LogFile logObj, long tolerance, long removeAge, java.lang.String msgNumFileName)
logObj
- log file object to use or null for no logging.tolerance
- number of milliseconds for time tolerance
that is used with time checks.removeAge
- number of milliseconds to keep messages in the cache.msgNumFileName
- message number file name or null for none.public IstiMessageObjectCache(LogFile logObj, long tolerance, long removeAge, java.lang.String msgNumFileName, boolean useLookupKeyFlag)
logObj
- log file object to use or null for no logging.tolerance
- number of milliseconds for time tolerance
that is used with time checks.removeAge
- number of milliseconds to keep messages in the cache.msgNumFileName
- message number file name or null for none.useLookupKeyFlag
- true to use the "keyStr" parameter (when
adding) as a table-lookup key (which forces cache entries to have
unique "keyStr" values).Method Detail |
public void addMsgObjEntry(IstiMessageObjectCache.MessageObjectEntry msgObj)
msgObj
- the message-object entry to add.public void addMessage(long timeGenerated, java.lang.Object msgObj, java.lang.String msgStr, long msgNum)
timeGenerated
- the time the message was generated.msgObj
- message object.msgStr
- message string.msgNum
- message number.public IstiTimeObjectCache.VectorWithCount getNewerMessages(long time, long msgNum, int maxCount)
time
- time in milliseconds.msgNum
- message number.maxCount
- the maximum number of messages to be returned,
or 0 for no limit.
public IstiTimeObjectCache.VectorWithCount getNewerMessages(long time, long msgNum)
time
- time in milliseconds.msgNum
- message number.
public IstiTimeObjectCache.VectorWithCount getMessages(long beginTime, long beginMsgNum, long endTime, long endMsgNum, int maxCount)
beginTime
- begin time in milliseconds or 0 for start of cache.beginMsgNum
- begin message number (objects with message
numbers after this one are to be returned).endTime
- end time in milliseconds or 0 for end of cacheendMsgNum
- end message number (objects with message numbers
before this one are to be returned).maxCount
- the maximum number of messages to be returned,
or 0 for no limit.
public IstiTimeObjectCache.VectorWithCount getMessages(long beginTime, long beginMsgNum, long endTime, long endMsgNum)
beginTime
- begin time in milliseconds or 0 for start of cache.beginMsgNum
- begin message number (objects with message
numbers after this one are to be returned).endTime
- end time in milliseconds or 0 for end of cacheendMsgNum
- end message number (objects with message numbers
before this one are to be returned).
public IstiTimeObjectCache.VectorWithCount getOlderMessages(long time, long msgNum, int maxCount)
time
- time in milliseconds.msgNum
- message number.maxCount
- the maximum number of messages to be returned,
or 0 for no limit.
public IstiTimeObjectCache.VectorWithCount getOlderMessages(long time, long msgNum)
time
- time in milliseconds.msgNum
- message number.
public IstiMessageObjectCache.MessageObjectEntry getFirstMessage()
public IstiMessageObjectCache.MessageObjectEntry getLastMessage()
public long getLastMsgNum()
protected java.lang.String getLogPrefixString()
getLogPrefixString
in class IstiTimeObjectCache
protected IstiMessageObjectCache.MessageObjectEntry getMessage(int index)
index
- index of the entry.
java.lang.ArrayIndexOutOfBoundsException
- if the index is negative
or not less than the current size of the cache.protected long getMsgTime(long msgNum)
msgNum
- the message number to use.
protected IstiTimeObjectCache.VectorWithCount subListVector(long beginTime, long beginMsgNum, long endTime, long endMsgNum, int maxCount)
beginTime
- minimum time (in milliseconds, inclusive) for
returned objects, or 0 for start of cache.beginMsgNum
- begin message number (objects with message
numbers after this one are to be returned).endTime
- maximum time (in milliseconds, inclusive) for
returned objects, or 0 for end of cache.endMsgNum
- end message number (objects with message numbers
before this one are to be returned).maxCount
- the maximum number of message objects to be returned,
or 0 for no limit.
public long getLastMsgNumSeqBreakTime()
protected void readMsgNumFile()
protected void writeMsgNumFile()
public void close()
close
in class IstiTimeObjectCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |