Class CarbonStuckThreadDetectionValve
- java.lang.Object
-
- org.apache.catalina.util.LifecycleBase
-
- org.apache.catalina.util.LifecycleMBeanBase
-
- org.apache.catalina.valves.ValveBase
-
- org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve
-
- All Implemented Interfaces:
MBeanRegistration,org.apache.catalina.Contained,org.apache.catalina.JmxEnabled,org.apache.catalina.Lifecycle,org.apache.catalina.Valve
public class CarbonStuckThreadDetectionValve extends org.apache.catalina.valves.ValveBaseTomcat valve for detecting stuck or long running threads
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.valves.ValveBase
asyncSupported, container, containerLog, next
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description CarbonStuckThreadDetectionValve()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackgroundProcess()static StringgetCorrelation()Get correlation id of current thread.protected voidinitInternal()voidinvoke(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response)static booleanisCorrelationIDPresent()Check whether correlation id present in the log MDC.voidsetThreshold(int threshold)Specify the threshold (in seconds) used when checking for stuck threads.-
Methods inherited from class org.apache.catalina.valves.ValveBase
getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, isAsyncSupported, setAsyncSupported, setContainer, setNext, startInternal, stopInternal, toString
-
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
-
-
-
-
Method Detail
-
setThreshold
public void setThreshold(int threshold)
Specify the threshold (in seconds) used when checking for stuck threads. If <=0, the detection is disabled. The default is 600 seconds.- Parameters:
threshold- The new threshold in seconds
-
initInternal
protected void initInternal() throws org.apache.catalina.LifecycleException- Overrides:
initInternalin classorg.apache.catalina.valves.ValveBase- Throws:
org.apache.catalina.LifecycleException
-
invoke
public void invoke(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response) throws IOException, javax.servlet.ServletException- Throws:
IOExceptionjavax.servlet.ServletException
-
backgroundProcess
public void backgroundProcess()
- Specified by:
backgroundProcessin interfaceorg.apache.catalina.Valve- Overrides:
backgroundProcessin classorg.apache.catalina.valves.ValveBase
-
isCorrelationIDPresent
public static boolean isCorrelationIDPresent()
Check whether correlation id present in the log MDC.- Returns:
- whether the correlation id is present
-
getCorrelation
public static String getCorrelation()
Get correlation id of current thread.- Returns:
- correlation-id
-
-