Classes | |
class | RateUpdater |
Public Member Functions | |
ACSLogRetrieval (ACSListenersDispatcher listenersDispatcher, boolean binFormat) | |
ACSLogRetrieval (ACSListenersDispatcher listenersDispatcher, boolean binFormat, ILogQueueFileHandler fileHandler) | |
ACSLogRetrieval (ACSListenersDispatcher listenersDispatcher, boolean binFormat, FiltersVector filters) | |
ACSLogRetrieval (ACSListenersDispatcher listenersDispatcher, boolean binFormat, FiltersVector filters, IResourceChecker resCecker) | |
void | addLog (String XMLLogStr) |
void | run () |
void | pause (boolean pause) |
void | close (boolean sync) |
boolean | hasPendingEntries () |
int | size () |
int | getInputRate () |
int | getOutputRate () |
int | getMaxInputRate () |
void | setMaxInputRate (int maxInRate) |
int | getMaxOutputRate () |
void | setMaxOutputRate (int maxOutRate) |
void | enableDynamicDiscarding (int threshold, int damping, int interval) |
void | setDiscardLevel (LogTypeHelper newLevel) |
LogTypeHelper | getDiscardLevel () |
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.
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval | ( | ACSListenersDispatcher | listenersDispatcher, | |
boolean | binFormat | |||
) |
Constructor
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 |
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval | ( | ACSListenersDispatcher | listenersDispatcher, | |
boolean | binFormat, | |||
ILogQueueFileHandler | fileHandler | |||
) |
Constructor
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 | |
The | handler for the files of the cache |
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval | ( | ACSListenersDispatcher | listenersDispatcher, | |
boolean | binFormat, | |||
FiltersVector | filters | |||
) |
Constructor
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 |
References com.cosylab.logging.engine.LogMatcher.setFilters().
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval | ( | ACSListenersDispatcher | listenersDispatcher, | |
boolean | binFormat, | |||
FiltersVector | filters, | |||
IResourceChecker | resCecker | |||
) |
A construct that allow passing a ResourceChecker.
This is mostly intended for testing purposes to simulate overloading or memory consumption.
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 |
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.addLog | ( | String | XMLLogStr | ) |
Add a log in the file
XMLLogStr | The XML string of the new log to add |
References com.cosylab.logging.engine.ACS.ACSListenersDispatcher.publishError(), and com.cosylab.logging.engine.cache.EngineCache.push().
Referenced by com.cosylab.logging.engine.ACS.ACSStructuredPushConsumer.push_structured_event().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.close | ( | boolean | sync | ) |
Close the threads and free all the resources
sync | If it is true wait the termination of the threads before returning |
References com.cosylab.logging.engine.cache.EngineCache.close().
Referenced by com.cosylab.logging.engine.ACS.LCEngine.close().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.enableDynamicDiscarding | ( | int | threshold, | |
int | damping, | |||
int | interval | |||
) |
Enable dynamic discarding of incoming logs.
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 . |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.enableDynamicDiscarding().
LogTypeHelper com.cosylab.logging.engine.ACS.ACSLogRetrieval.getDiscardLevel | ( | ) |
Return the discard level set by the user
Referenced by com.cosylab.logging.engine.ACS.LCEngine.getDiscardLevel().
int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getInputRate | ( | ) |
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.
Referenced by com.cosylab.logging.engine.ACS.LCEngine.getActualInputRate().
int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getMaxInputRate | ( | ) |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.getMaxInputRate().
int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getMaxOutputRate | ( | ) |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.getMaxOutputRate().
int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getOutputRate | ( | ) |
Return the number of strings read from the cache in the last second limited. It can never be greater then the max rate.
Referenced by com.cosylab.logging.engine.ACS.LCEngine.getActualOutputRate().
boolean com.cosylab.logging.engine.ACS.ACSLogRetrieval.hasPendingEntries | ( | ) |
Check if there are logs to be published in the cache.
References com.cosylab.logging.engine.cache.EngineCache.size().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.pause | ( | boolean | pause | ) |
Pause/unpause the thread that publishes logs
pause |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.setPaused().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.run | ( | ) |
The thread to read and notify the logs read from the file to the listeners
References alma.acs.logging.engine.parser.ACSLogParser.parse(), com.cosylab.logging.engine.cache.EngineCache.pop(), com.cosylab.logging.engine.ACS.ACSListenersDispatcher.publishConnected(), com.cosylab.logging.engine.ACS.ACSListenersDispatcher.publishDiscarding(), com.cosylab.logging.engine.ACS.ACSListenersDispatcher.publishError(), com.cosylab.logging.engine.ACS.ACSListenersDispatcher.publishReport(), com.cosylab.logging.engine.cache.EngineCache.size(), and com.cosylab.logging.engine.log.ILogEntry.toXMLString().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.setDiscardLevel | ( | LogTypeHelper | newLevel | ) |
Set the discard level
Note: if dynamic filtering by memory is enabled then the discard level effectively used can be greater then this value.
newLevel | The new discard level (null means no discard level). |
Reimplemented from com.cosylab.logging.engine.LogMatcher.
References com.cosylab.logging.engine.LogMatcher.actualDiscardLevel.
Referenced by com.cosylab.logging.engine.ACS.LCEngine.setDiscardLevel().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.setMaxInputRate | ( | int | maxInRate | ) |
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.
maxInRate | The max number of logs per second to push in cache. Integer.MAX_VALUE means unlimited |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.setMaxInputRate().
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.setMaxOutputRate | ( | int | maxOutRate | ) |
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.
maxOutRate | The max number of logs per second to read from cache. Integer.MAX_VALUE means unlimited |
Referenced by com.cosylab.logging.engine.ACS.LCEngine.setMaxOutputRate().
int com.cosylab.logging.engine.ACS.ACSLogRetrieval.size | ( | ) |
Return the number of entries in the cache
References com.cosylab.logging.engine.cache.EngineCache.size().
Referenced by com.cosylab.logging.engine.ACS.LCEngine.waitingLogsNumber().