Package ca.uhn.fhir.jpa.util
Class CircularQueueCaptureQueriesListener
java.lang.Object
ca.uhn.fhir.jpa.util.BaseCaptureQueriesListener
ca.uhn.fhir.jpa.util.CircularQueueCaptureQueriesListener
- All Implemented Interfaces:
net.ttddyy.dsproxy.support.ProxyDataSourceBuilder.SingleMethodExecution
,net.ttddyy.dsproxy.support.ProxyDataSourceBuilder.SingleQueryExecution
This is a query listener designed to be plugged into a
proxy DataSource
.
This listener keeps the last 1000 queries across all threads in a CircularFifoQueue
, dropping queries off the
end of the list as new ones are added.
Note that this class is really only designed for use in testing - It adds a non-trivial overhead to each query.
-
Field Summary
Modifier and TypeFieldDescription -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all stored queriesint
int
int
int
int
int
int
int
Returns all queries executed on the current thread - Index 0 is oldestIndex 0 is oldestint
Returns all UPDATE queries executed on the current thread - Index 0 is oldestReturns all UPDATE queries executed on the current thread - Index 0 is oldestReturns all INSERT queries executed on the current thread - Index 0 is oldestReturns all INSERT queries executed on the current thread - Index 0 is oldestint
Returns all SELECT queries executed on the current thread - Index 0 is oldestReturns all SELECT queries executed on the current thread - Index 0 is oldestReturns all UPDATE queries executed on the current thread - Index 0 is oldestReturns all UPDATE queries executed on the current thread - Index 0 is oldestvoid
Log all captured queriesvoid
Log all captured queriesint
Log all captured DELETE queriesLog all captured DELETE queriesvoid
Log first captured SELECT queryint
Log all captured INSERT queriesint
logInsertQueries
(Predicate<SqlQuery> theInclusionPredicate) Log all captured INSERT queriesLog all captured INSERT queriesLog all captured SELECT querieslogSelectQueries
(boolean theInlineParams, boolean theFormatSql) Log all captured SELECT querieslogSelectQueriesForCurrentThread
(int... theIndexes) Log all captured SELECT queriesint
Log all captured INSERT queriesLog all captured UPDATE queriesprotected AtomicInteger
protected AtomicInteger
setSelectQueryInclusionCriteria
(Predicate<String> theSelectQueryInclusionCriteria) Sets an alternate inclusion criteria for select queries.void
Start collecting queries (this is the default)void
Stop collecting queries and discard any collected onesMethods inherited from class ca.uhn.fhir.jpa.util.BaseCaptureQueriesListener
countCommits, countRollbacks, execute, execute, isCaptureQueryStackTrace, setCaptureQueryStackTrace
-
Field Details
-
DEFAULT_SELECT_INCLUSION_CRITERIA
-
-
Constructor Details
-
CircularQueueCaptureQueriesListener
public CircularQueueCaptureQueriesListener()Constructor
-
-
Method Details
-
setSelectQueryInclusionCriteria
public CircularQueueCaptureQueriesListener setSelectQueryInclusionCriteria(@Nonnull Predicate<String> theSelectQueryInclusionCriteria) Sets an alternate inclusion criteria for select queries. This can be used to add additional criteria beyond the default value ofDEFAULT_SELECT_INCLUSION_CRITERIA
. -
provideQueryList
- Specified by:
provideQueryList
in classBaseCaptureQueriesListener
-
provideCommitCounter
- Specified by:
provideCommitCounter
in classBaseCaptureQueriesListener
-
provideRollbackCounter
- Specified by:
provideRollbackCounter
in classBaseCaptureQueriesListener
-
clear
Clear all stored queries -
startCollecting
Start collecting queries (this is the default) -
stopCollecting
Stop collecting queries and discard any collected ones -
getCapturedQueries
Index 0 is oldest -
getCommitCount
-
getRollbackCount
-
getSelectQueries
Returns all SELECT queries executed on the current thread - Index 0 is oldest -
getInsertQueries
Returns all INSERT queries executed on the current thread - Index 0 is oldest -
getUpdateQueries
Returns all UPDATE queries executed on the current thread - Index 0 is oldest -
getDeleteQueries
Returns all UPDATE queries executed on the current thread - Index 0 is oldest -
getSelectQueriesForCurrentThread
Returns all SELECT queries executed on the current thread - Index 0 is oldest -
getInsertQueriesForCurrentThread
Returns all INSERT queries executed on the current thread - Index 0 is oldest -
getAllQueriesForCurrentThread
Returns all queries executed on the current thread - Index 0 is oldest -
getUpdateQueriesForCurrentThread
Returns all UPDATE queries executed on the current thread - Index 0 is oldest -
getDeleteQueriesForCurrentThread
Returns all UPDATE queries executed on the current thread - Index 0 is oldest -
logUpdateQueriesForCurrentThread
Log all captured UPDATE queries -
logSelectQueriesForCurrentThread
Log all captured SELECT queries -
logSelectQueries
Log all captured SELECT queries -
logSelectQueries
Log all captured SELECT queries -
logFirstSelectQueryForCurrentThread
Log first captured SELECT query -
logInsertQueriesForCurrentThread
Log all captured INSERT queries -
logAllQueriesForCurrentThread
Log all captured queries -
logAllQueries
Log all captured queries -
logInsertQueries
Log all captured INSERT queries -
logInsertQueries
Log all captured INSERT queries -
logUpdateQueries
Log all captured INSERT queries -
logDeleteQueriesForCurrentThread
Log all captured DELETE queries -
logDeleteQueries
Log all captured DELETE queries -
countSelectQueries
-
countInsertQueries
-
countUpdateQueries
-
countDeleteQueries
-
countSelectQueriesForCurrentThread
-
countInsertQueriesForCurrentThread
-
countUpdateQueriesForCurrentThread
-
countDeleteQueriesForCurrentThread
-