Classes | Public Member Functions

com.cosylab.logging.engine.ACS.ACSLogRetrieval Class Reference

Inheritance diagram for com.cosylab.logging.engine.ACS.ACSLogRetrieval:
com.cosylab.logging.engine.LogMatcher

List of all members.

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 ()

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 
)

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
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval ( ACSListenersDispatcher  listenersDispatcher,
boolean  binFormat,
ILogQueueFileHandler  fileHandler 
)

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
The handler for the files of the cache
com.cosylab.logging.engine.ACS.ACSLogRetrieval.ACSLogRetrieval ( ACSListenersDispatcher  listenersDispatcher,
boolean  binFormat,
FiltersVector  filters 
)

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

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.

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  ) 
void com.cosylab.logging.engine.ACS.ACSLogRetrieval.close ( boolean  sync  ) 

Close the threads and free all the resources

Parameters:
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.

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)

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

Returns:
the discardLevel
See also:
etDiscardLevel(LogTypeHelper newLevel)

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.

Returns:
The number of strings received in the last second

Referenced by com.cosylab.logging.engine.ACS.LCEngine.getActualInputRate().

int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getMaxInputRate (  ) 
Returns:
The max number of strings pushed in the cache per second

Referenced by com.cosylab.logging.engine.ACS.LCEngine.getMaxInputRate().

int com.cosylab.logging.engine.ACS.ACSLogRetrieval.getMaxOutputRate (  ) 
Returns:
The maximum number of logs published per second

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.

Returns:
The number of strings read from the cache in the last second

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.

Returns:
true if there are logs to be processed in the file

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

Parameters:
pause 

Referenced by com.cosylab.logging.engine.ACS.LCEngine.setPaused().

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.

Parameters:
newLevel The new discard level (null means no discard level).
See also:
enableDynamicDiscarding(int threashold)
getDiscardLevel()

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.

Parameters:
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.

Parameters:
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

Returns:
the number of entries in the cache

References com.cosylab.logging.engine.cache.EngineCache.size().

Referenced by com.cosylab.logging.engine.ACS.LCEngine.waitingLogsNumber().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties