Package com.avoka.core.cayenne
Class ExecutionContext
- java.lang.Object
-
- com.avoka.core.cayenne.ExecutionContext
-
public class ExecutionContext extends Object
Provides the Execution Context utility.
-
-
Field Summary
Fields Modifier and Type Field Description static StringQUERY_CACHINGThe Query Caching JVM argument key.static StringQUERY_PROFILINGThe Query Profiling JVM argument key.static StringQUERY_PROFILING_DETAILThe Query Profiling Detail JVM argument key.static StringQUERY_PROFILING_THRESHOLDThe Query Profiling Warning Threshold JVM argument key.
-
Constructor Summary
Constructors Constructor Description ExecutionContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.avoka.core.cayenne.ExecutionContext.QueryInfoaddQueryInfo(String sql, long time)Record the query info.Map<String,BaseEntity>getQueryCacheMap()Return the query cache map.StringgetQueryInfoDump(boolean showDetails)Return the query info profiling dump.LonggetQueryProfilingWarningThreshold()Return the query execution warning threshold in milliseconds.static ExecutionContextgetThreadExecutionContext()Returns the thread execution context.booleanisAuditingEnabled()booleanisCachingEnabled()booleanisQueryCacheEnabled()booleanisQueryProfilingEnabled()Return true if query profiling is enabled.voidsetAuditingEnabled(boolean auditingEnabled)voidsetCachingEnabled(boolean cachingEnabled)voidsetQueryCacheEnabled(boolean queryCacheEnabled)voidsetQueryProfilingEnable(boolean queryProfilingEnabled)Set queryProfilingEnabled.voidsetQueryProfilingWarningThreshold(Long value)Set the query execution warning threshold in milliseconds.static voidsetThreadExecutionContext(ExecutionContext executionContext)Sets the thread execution context.
-
-
-
Field Detail
-
QUERY_CACHING
public static final String QUERY_CACHING
The Query Caching JVM argument key.- See Also:
- Constant Field Values
-
QUERY_PROFILING
public static final String QUERY_PROFILING
The Query Profiling JVM argument key.- See Also:
- Constant Field Values
-
QUERY_PROFILING_DETAIL
public static final String QUERY_PROFILING_DETAIL
The Query Profiling Detail JVM argument key.- See Also:
- Constant Field Values
-
QUERY_PROFILING_THRESHOLD
public static final String QUERY_PROFILING_THRESHOLD
The Query Profiling Warning Threshold JVM argument key.- See Also:
- Constant Field Values
-
-
Method Detail
-
setThreadExecutionContext
public static void setThreadExecutionContext(ExecutionContext executionContext)
Sets the thread execution context.- Parameters:
executionContext- the new thread execution context
-
getThreadExecutionContext
public static ExecutionContext getThreadExecutionContext()
Returns the thread execution context.- Returns:
- the thread execution context
-
isCachingEnabled
public boolean isCachingEnabled()
- Returns:
- the cachingEnabled
-
setCachingEnabled
public void setCachingEnabled(boolean cachingEnabled)
- Parameters:
cachingEnabled- the cachingEnabled to set
-
isAuditingEnabled
public boolean isAuditingEnabled()
- Returns:
- the auditingEnabled
-
setAuditingEnabled
public void setAuditingEnabled(boolean auditingEnabled)
- Parameters:
auditingEnabled- the auditingEnabled to set
-
isQueryCacheEnabled
public boolean isQueryCacheEnabled()
- Returns:
- the queryCacheEnabled
- Since:
- 4.2.0
-
setQueryCacheEnabled
public void setQueryCacheEnabled(boolean queryCacheEnabled)
- Parameters:
queryCacheEnabled- the queryCacheEnabled to set- Since:
- 4.2.0
-
setQueryProfilingEnable
public void setQueryProfilingEnable(boolean queryProfilingEnabled)
Set queryProfilingEnabled.- Parameters:
queryProfilingEnabled- set queryProfilingEnabled- Since:
- 4.2.0
-
isQueryProfilingEnabled
public boolean isQueryProfilingEnabled()
Return true if query profiling is enabled.- Returns:
- true if query profiling is enabled
- Since:
- 4.2.0
-
setQueryProfilingWarningThreshold
public void setQueryProfilingWarningThreshold(Long value)
Set the query execution warning threshold in milliseconds.- Parameters:
value- the query execution warning threshold in milliseconds- Since:
- 4.3.0
-
getQueryProfilingWarningThreshold
public Long getQueryProfilingWarningThreshold()
Return the query execution warning threshold in milliseconds.- Returns:
- the query execution warning threshold in milliseconds
- Since:
- 4.3.0
-
addQueryInfo
public com.avoka.core.cayenne.ExecutionContext.QueryInfo addQueryInfo(String sql, long time)
Record the query info.- Parameters:
sql- the SQL query performedtime- the time in ms to execute the query- Returns:
- the new QueryInfo object
- Since:
- 4.2.0
-
getQueryInfoDump
public String getQueryInfoDump(boolean showDetails)
Return the query info profiling dump.- Parameters:
showDetails- display SQL call details- Returns:
- the query info profiling dump.
- Since:
- 4.2.0
-
getQueryCacheMap
public Map<String,BaseEntity> getQueryCacheMap()
Return the query cache map.- Returns:
- the query cache map.
- Since:
- 4.2.0
-
-