com::cosylab::logging::engine::ACS::ACSLogRetrieval Class Reference
Inheritance diagram for com::cosylab::logging::engine::ACS::ACSLogRetrieval:
[legend]Collaboration diagram for com::cosylab::logging::engine::ACS::ACSLogRetrieval:
[legend]List of all members.
Detailed Description
ACSLogRetrieval
stores the XML string (or a String in case of binary logs) representing logs on a file when the engine is not able to follow the flow of the incoming logs The strings are stored on disk and the logs published to the listeners when there is enough CPU available.
ACSLogRetrieval
allows to set the rate (i.e. number of logs per second) for the logs to receive and push in cache. All the logs received after this limit has been reached are discarded regardless of their content. This option must be used very carefully because can cause loss of logs.
It also allows to set the rate i.e. number of logs per second) for the logs read from the cache and published to listener. When the limit has been reached, no logs are pushed anymore out of the cache until the current second has elapsed. This limitation must be used very carefully because it can cause a uncontrolled growth of the cache that could lead to an out of memory.
By default, the input and output rates are unlimited (Integer.MAX_VALUE
)
The available memory is checked every second. To avoid out of memory the user can enable the dynamic discarding by giving a threshold (in bytes). If a threshold is defined, the thread that checks the amount of available memory increases the discard level. To avoid oscillations, the user can define a a damping factor: the discard level is decreased when the amount of available memory is greater the the threshold plus the damping.
- See also:
- ACSRemoteLogListener
ACSRemoteRawLogListener
ACSLogConnectionListener
Constructor & Destructor Documentation
com::cosylab::logging::engine::ACS::ACSLogRetrieval::ACSLogRetrieval |
( |
ACSListenersDispatcher |
listenersDispatcher, |
|
|
boolean |
binFormat |
|
) |
[inline] |
|
|
Constructor
- Parameters:
-
| listenersDispatcher | The object to send messages to the listeners Can't be null |
| binFormat | true if the lags are binary, false if XML format is used |
|
|
Constructor
- Parameters:
-
| listenersDispatcher | The object to send messages to the listeners Can't be null |
| binFormat | true if the lags are binary, false if XML format is used |
| filters | The filters to apply to incoming logs If null or empty no filters are applied |
|
|
A construct that allow passing a ResourceChecker.
This is mostly intended for testing purposes to simulate overloading or memory consumption.
- Parameters:
-
| listenersDispatcher | The object to send messages to the listeners Can't be null |
| binFormat | true if the lags are binary, false if XML format is used |
| filters | The filters to apply to incoming logs If null or empty no filters are applied |
| roCecher | |
|
Member Function Documentation
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::addLog |
( |
String |
XMLLogStr |
) |
[inline] |
|
|
Add a log in the file
- Parameters:
-
| XMLLogStr | The XML string of the new log to add |
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::checkMemory |
( |
long |
freeMem |
) |
[inline, private] |
|
|
Check the available memory against the threshold and the damping factor to increase/decrease the discard level.
- Parameters:
-
| freeMem | The amount of available memory to the application in bytes. |
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::close |
( |
boolean |
sync |
) |
[inline] |
|
|
Close the threads and free all the resources
- Parameters:
-
| sync | If it is true wait the termination of the threads before returning |
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::enableDynamicDiscarding |
( |
int |
threshold, |
|
|
int |
damping, |
|
|
int |
interval |
|
) |
[inline] |
|
|
Enable dynamic discarding of incoming logs.
- Parameters:
-
| threashold | The discard level is increased when the available memory for the application is less then the threshold (in bytes). Integer.MAX_VALUE disables this feature. |
| damping | The damping factor is used to avoid oscillations The discard level is decreased when the free memory is is greater then the threshold plus the dumping . |
| interval | The time (in seconds) between two adjustments of the dynamic discard level. interval defaults to 10 . |
- See also:
- setDiscardLevel(LogTypeHelper newLevel)
|
LogTypeHelper com::cosylab::logging::engine::ACS::ACSLogRetrieval::getDiscardLevel |
( |
|
) |
[inline] |
|
|
Return the discard level set by the user
- Returns:
- the discardLevel
- See also:
- etDiscardLevel(LogTypeHelper newLevel)
|
int com::cosylab::logging::engine::ACS::ACSLogRetrieval::getInputRate |
( |
|
) |
[inline] |
|
|
Return the number of strings received in the last second. Note that the number of received strings can be greater then the max number of input strings.
- Returns:
- The number of strings received in the last second
|
int com::cosylab::logging::engine::ACS::ACSLogRetrieval::getMaxInputRate |
( |
|
) |
[inline] |
|
|
- Returns:
- The max number of strings pushed in the cache per second
|
int com::cosylab::logging::engine::ACS::ACSLogRetrieval::getMaxOutputRate |
( |
|
) |
[inline] |
|
|
- Returns:
- The maximum number of logs published per second
|
int com::cosylab::logging::engine::ACS::ACSLogRetrieval::getOutputRate |
( |
|
) |
[inline] |
|
|
Return the number of strings read from the cache in the last second limited. It can never be greater then the max rate.
- Returns:
- The number of strings read from the cache in the last second
|
boolean com::cosylab::logging::engine::ACS::ACSLogRetrieval::hasPendingEntries |
( |
|
) |
[inline] |
|
|
Check if there are logs to be published in the cache.
- Returns:
- true if there are logs to be processed in the file
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::initialize |
( |
|
) |
[inline, private] |
|
|
Init the file and the parser |
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::pause |
( |
boolean |
pause |
) |
[inline] |
|
|
Pause/unpause the thread that publishes logs
- Parameters:
-
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::publishLog |
( |
String |
xmlLog, |
|
|
ILogEntry |
log |
|
) |
[inline, private] |
|
|
Send the logs to the listeners.
The filters are applied before sending the log to the listener.
XML logs are not filtered.
- Parameters:
-
| xmlLog | The XML (RAW) log |
| log | The log |
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::run |
( |
|
) |
[inline] |
|
|
The thread to read and notify the logs read from the file to the listeners |
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::setDiscardLevel |
( |
LogTypeHelper |
newLevel |
) |
[inline] |
|
|
Set the discard level
Note: if dynamic filtering by memory is enabled then the discard level effectively used can be greater then this value.
- Parameters:
-
| newLevel | The new discard level (null means no discard level). |
- See also:
- enableDynamicDiscarding(int threashold)
getDiscardLevel()
Reimplemented from com::cosylab::logging::engine::LogMatcher.
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::setMaxInputRate |
( |
int |
maxInRate |
) |
[inline] |
|
|
Set the max number of logs to process per second.
All the logs in a second read after this number has been reached are discarded i.e. never pushed in the cache.
- Parameters:
-
| maxInRate | The max number of logs per second to push in cache. Integer.MAX_VALUE means unlimited |
|
void com::cosylab::logging::engine::ACS::ACSLogRetrieval::setMaxOutputRate |
( |
int |
maxOutRate |
) |
[inline] |
|
|
Set the max number of logs to read from the cache per second.
All the logs in a second read after this number has been reached are discarded i.e. never published to listeners.
- Parameters:
-
| maxOutRate | The max number of logs per second to read from cache. Integer.MAX_VALUE means unlimited |
|
int com::cosylab::logging::engine::ACS::ACSLogRetrieval::size |
( |
|
) |
[inline] |
|
|
Return the number of entries in the cache
- Returns:
- the number of entries in the cache
|
Member Data Documentation
|
damping is used to avoid oscillations in the discard level.
When the available memory is below the threshold , the discard level is immediately increased. To decrease the discard level instead the free memory must be greater then threshold+damping .
damping must be greater or equal to 0 . |
|
The time (in seconds) between two adjustments of the dynamic discard level. |
|
The number of logs per second pushed in the cache.
This is changed by the thread every second to be equal to receivedCounter |
|
The time when the dynamic discard level has been updated the last time (msec) |
|
The max input rate (i.e. the max number of strings to push in the cache per second.
If the number of logs received in the current second is greater then this number, then the strings are discarded.
Note: maxinputRate should be used carefully because it causes the loss of information |
|
The max output rate (i.e. the max number of strings to read from in the cache per second).
If the number of logs received in the current second is greater then this number, then the strings are removed from the cache but discarded without being sent to the listener
Note: maxOutputRate should be used carefully because it causes the loss of information |
|
The number of logs per second popped from the cache
This is changed by the thread every second to be equal to readCounter |
|
Counts the number of logs popped every second |
|
Counts the number of logs received every second |
|
resourceChecker gets the details of the memory allocation |
|
The threshold, in bytes, to dynamically increase the discard level.
The discard level is increased of one step whenever the available memory for the application is greater then this number. |
|
The timer to update the input and output rates |
|
The discard level set by the user |
The documentation for this class was generated from the following file:
Generated on Thu Apr 30 03:13:08 2009 for ACS Java API by
1.3.8