Class TracingTimingMethodInterceptor
- java.lang.Object
-
- com.c12e.cortex.profiles.intercept.TracingTimingMethodInterceptor
-
- All Implemented Interfaces:
CortexInterceptor
,org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
public class TracingTimingMethodInterceptor extends java.lang.Object implements CortexInterceptor
Intercepts proxied methods and prints a trace of invocations with call duration.
Cortex options specific to this interceptor: "spark.cortex.test.intercept.timing.outfile", seeCORTEX_OUTPUT_FILENAME_OPTION
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CORTEX_OUTPUT_FILENAME_OPTION
Key in Cortex config options for specifying the filename the call durations should be written too.static java.lang.String
GUICE_ENHANCED
-
Constructor Summary
Constructors Constructor Description TracingTimingMethodInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
invoke(org.aopalliance.intercept.MethodInvocation invocation)
void
postIntercept(java.util.Map<java.lang.String,java.lang.String> cortexSessionOptions)
Saves the captured method timings to an output file based on the given session option.java.util.Map<java.lang.String,java.lang.String>
suggestedOptions(java.lang.String value)
Suggests default options for the interceptor.void
writeFile(java.lang.String file)
-
-
-
Field Detail
-
GUICE_ENHANCED
public static final java.lang.String GUICE_ENHANCED
- See Also:
- Constant Field Values
-
CORTEX_OUTPUT_FILENAME_OPTION
public static final java.lang.String CORTEX_OUTPUT_FILENAME_OPTION
Key in Cortex config options for specifying the filename the call durations should be written too.- See Also:
- Constant Field Values
-
-
Method Detail
-
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
-
suggestedOptions
public java.util.Map<java.lang.String,java.lang.String> suggestedOptions(java.lang.String value)
Description copied from interface:CortexInterceptor
Suggests default options for the interceptor.- Specified by:
suggestedOptions
in interfaceCortexInterceptor
- Parameters:
value
- context dependent value for customization- Returns:
- suggested default options
-
postIntercept
public void postIntercept(java.util.Map<java.lang.String,java.lang.String> cortexSessionOptions)
Saves the captured method timings to an output file based on the given session option. If "spark.cortex.test.intercept.timing.outfile" is not present in session options then anIllegalArgumentException
.- Specified by:
postIntercept
in interfaceCortexInterceptor
- Parameters:
cortexSessionOptions
- Configuration options from the CortexSession
-
writeFile
public void writeFile(java.lang.String file) throws java.io.IOException
- Throws:
java.io.IOException
-
-