public class SlowQueryListener extends Object implements QueryExecutionListener
onSlowQuery(ExecutionInfo, List, long) callback method
is called. The callback is called only once for the target query if it exceeds the threshold time.CommonsSlowQueryListener,
JULSlowQueryListener,
SLF4JSlowQueryListener,
SystemOutSlowQueryListener| Modifier and Type | Field and Description |
|---|---|
protected ScheduledExecutorService |
executor |
protected Map<ExecutionInfo,Long> |
inExecution |
protected long |
threshold |
protected TimeUnit |
thresholdTimeUnit |
DEFAULT| Constructor and Description |
|---|
SlowQueryListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterQuery(ExecutionInfo execInfo,
List<QueryInfo> queryInfoList) |
void |
beforeQuery(ExecutionInfo execInfo,
List<QueryInfo> queryInfoList) |
ScheduledExecutorService |
getExecutor() |
long |
getThreshold() |
TimeUnit |
getThresholdTimeUnit() |
protected void |
onSlowQuery(ExecutionInfo execInfo,
List<QueryInfo> queryInfoList,
long startTimeInMills)
Callback when query execution time exceeds the threshold.
|
void |
setThreshold(long threshHold) |
void |
setThresholdTimeUnit(TimeUnit thresholdTimeUnit) |
protected ScheduledExecutorService executor
protected long threshold
protected TimeUnit thresholdTimeUnit
protected Map<ExecutionInfo,Long> inExecution
public void beforeQuery(ExecutionInfo execInfo, List<QueryInfo> queryInfoList)
beforeQuery in interface QueryExecutionListenerpublic void afterQuery(ExecutionInfo execInfo, List<QueryInfo> queryInfoList)
afterQuery in interface QueryExecutionListenerprotected void onSlowQuery(ExecutionInfo execInfo, List<QueryInfo> queryInfoList, long startTimeInMills)
execInfo - query execution infoqueryInfoList - query parameter infostartTimeInMills - time in mills when the query startedpublic void setThreshold(long threshHold)
public void setThresholdTimeUnit(TimeUnit thresholdTimeUnit)
public ScheduledExecutorService getExecutor()
public long getThreshold()
public TimeUnit getThresholdTimeUnit()
Copyright © 2017. All rights reserved.