Class StatisticsQueue
java.lang.Object
org.javalite.activejdbc.statistics.StatisticsQueue
This class will collect statistics on executed queries and then can produce reports sorted by
various parameters. Configuration is simple, add this line:
collectStatistics=trueto the file
activejdbc.properties
on the command line.
After that, simply collect reports like this:
Listtotals = Registry.getStatisticsQueue().getReportSortedBy("total") {
- Author:
- Igor Polevoy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionenqueue(QueryExecutionEvent event)
Enqueues a query execution event for processing.getReportSortedBy(String sortByVal)
Produces a report sorted by one of the accepted value.boolean
isPaused()
void
pause(boolean val)
void
reset()
void
stop()
Shutdowns StatisticsQueue completely, new StatisticsQueue should be created to start gathering statistics again
-
Constructor Details
-
StatisticsQueue
public StatisticsQueue(boolean paused)
-
-
Method Details
-
isPaused
public boolean isPaused() -
stop
public void stop()Shutdowns StatisticsQueue completely, new StatisticsQueue should be created to start gathering statistics again -
pause
public void pause(boolean val) -
enqueue
Enqueues a query execution event for processing.- Parameters:
event
- instance of event.- Returns:
- instance of Future associated with processing of event. You can examine that object
to see if this event was processed. In case the queue is paused, an event is not processed,
and return value is
null
.
-
reset
public void reset() -
getReportSortedBy
Produces a report sorted by one of the accepted value.- Parameters:
sortByVal
- - allowed values: "total", "avg", "min", "max", "count"- Returns:
- sorted list of query stats
-