public abstract class AdaptiveQueryTraceAspect
extends java.lang.Object
aop.xml file. That concrete aspect must define a pointcut for the abstract
adaptiveScope() method.| Modifier and Type | Class and Description |
|---|---|
private static class |
AdaptiveQueryTraceAspect.OverviewData
Nested class used to keep track of information belonging to all of the
AdaptiveQueries traced.
|
private static class |
AdaptiveQueryTraceAspect.SingleData
Nested class used to keep track of information belonging to only one
AdaptiveQuery that is traced.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CSV_FILE
Fixed name of CSV output file (written to current directory)
|
private static boolean |
enabled
Flag which controls data collection
|
private static CentralLogger |
LOG
Logger
|
private static java.util.List<java.lang.reflect.Method> |
operations
List of methods that are traced
|
private static boolean |
OUTPUT_ALL_QUERIES
Flag that controls if all or just the invalidated queries will be displayed
|
private static AdaptiveQueryTraceAspect.OverviewData |
overviewData
Data storage for all AdaptiveQueries
|
private static long |
PARENT_CALL_AMOUNT_LIMIT
Value that controls the parents displayed after the overview data,
it will only display parents that were called more times than the
set value.
|
private static java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> |
parentCalls
Map storing SingleData.parent and how many times
the parent triggered new AdaptiveQuery instances.
|
private static java.util.Map<AdaptiveQuery,AdaptiveQueryTraceAspect.SingleData> |
traceData
Map of profile data by method signature
|
| Constructor and Description |
|---|
AdaptiveQueryTraceAspect() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
adaptiveScope()
An abstract pointcut which should be defined for load-time weaving inside a
concrete-aspect element within META-INF/aop.xml. |
static java.lang.String |
calculatePercentage(java.util.concurrent.atomic.AtomicLongArray value,
java.util.concurrent.atomic.AtomicLongArray total,
int position)
Calculate the percentage of a value from a total in
an AtomicLongArray, being given a position.
|
boolean |
checkNotEnable(org.aspectj.lang.ProceedingJoinPoint pjp)
Check if tracing is enabled or method traced is one of the methods
that can cause recursive calls.
|
boolean |
checkUpdateTableCount(org.aspectj.lang.ProceedingJoinPoint joinPoint)
Check if the current method is AdaptiveQuery.execute().
|
static void |
enableDataCollection(boolean enable)
Enable or disable data collection.
|
int |
getOperationIfAny(org.aspectj.lang.ProceedingJoinPoint joinPoint)
Check if the current traced method is an operation that
exists in the list of traced methods.
|
java.lang.String |
getStackMethodParent(java.lang.StackTraceElement[] ste)
Search for the parent that eventually led to the AdaptiveQuery in a StackTrace.
|
void |
handleAdaptiveQueryDetails(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Displays data about the current traced AdaptiveQuery method.
|
void |
handleAdaptiveQueryScrollingStatus(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Introduces new data to an existent SingleData instance belonging to
an AdaptiveQuery regarding it's Scrolling status.
|
void |
handleInvalidation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Introduces new data to an existent SingleData instance belonging to
an AdaptiveQuery when the operation is AdaptiveQuery.invalidate().
|
void |
handleOperation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Introduces new data to an existent SingleData instance belonging to
an AdaptiveQuery when the operation was defined in the specific
operation list.
|
void |
handleRevalidation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Introduces new data to an existent SingleData instance belonging to
an AdaptiveQuery when the operation is AdaptiveQuery.revalidate().
|
void |
handleStateChanged(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
Introduces new data to an existent SingleData instance belonging to
an AdaptiveQuery when the operation is AdaptiveQuery.stateChanged().
|
(package private) static void |
initialize()
Method that initializes the operations traced in AdaptiveQuery
and creates an instance of OverviewData which depends on the
number of operations traced.
|
boolean |
isDoubleCheckMethod(org.aspectj.lang.ProceedingJoinPoint joinPoint)
Checks if the current method is AdaptiveQuery.doubleCheckInvalidation().
|
static void |
processData()
Post-process the collected trace data and log the results.
|
java.lang.Object |
trace(org.aspectj.lang.ProceedingJoinPoint joinPoint)
The primary tracing advice which collects trace information about calls to the
AdaptiveQuery class.
|
private static final CentralLogger LOG
private static volatile boolean enabled
private static final java.util.Map<AdaptiveQuery,AdaptiveQueryTraceAspect.SingleData> traceData
private static final java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> parentCalls
private static AdaptiveQueryTraceAspect.OverviewData overviewData
private static final java.util.List<java.lang.reflect.Method> operations
private static java.lang.String CSV_FILE
private static final boolean OUTPUT_ALL_QUERIES
private static final long PARENT_CALL_AMOUNT_LIMIT
static void initialize()
public static void enableDataCollection(boolean enable)
enable - true to start data collection; false to stop it and process the
results.public static void processData()
public static java.lang.String calculatePercentage(java.util.concurrent.atomic.AtomicLongArray value,
java.util.concurrent.atomic.AtomicLongArray total,
int position)
value - Value divided by the totaltotal - Total for divisionposition - Position of the value and total
in the AtomicLongArraypublic abstract void adaptiveScope()
concrete-aspect element within META-INF/aop.xml.public java.lang.Object trace(org.aspectj.lang.ProceedingJoinPoint joinPoint)
throws java.lang.Throwable
joinPoint - Join point which represents the method being traced.java.lang.Throwable - if an exception is thrown by the method being traced.public void handleAdaptiveQueryDetails(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public void handleAdaptiveQueryScrollingStatus(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public void handleInvalidation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public void handleRevalidation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public void handleStateChanged(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public void handleOperation(org.aspectj.lang.ProceedingJoinPoint joinPoint,
AdaptiveQueryTraceAspect.SingleData data)
joinPoint - Join point which represents the method being traced.data - Information of an AdaptiveQuery.public boolean checkUpdateTableCount(org.aspectj.lang.ProceedingJoinPoint joinPoint)
joinPoint - Join point which represents the method being traced.public boolean isDoubleCheckMethod(org.aspectj.lang.ProceedingJoinPoint joinPoint)
joinPoint - Join point which represents the method being traced.public int getOperationIfAny(org.aspectj.lang.ProceedingJoinPoint joinPoint)
joinPoint - Join point which represents the method being traced.public boolean checkNotEnable(org.aspectj.lang.ProceedingJoinPoint pjp)
pjp - Join point which represents the method being traced.public java.lang.String getStackMethodParent(java.lang.StackTraceElement[] ste)
ste - A StackTraceElement array containing the current thread trace
until it reached the trace method.