org.apache.catalina.valves

## Class StuckThreadDetectionValve

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.util.LifecycleMBeanBase
    - - org.apache.catalina.valves.ValveBase
      - - org.apache.catalina.valves.StuckThreadDetectionValve

All Implemented Interfaces:
  MBeanRegistration, Contained, Lifecycle, Valve

    public class StuckThreadDetectionValve
    extends ValveBase

This valve allows to detect requests that take a long time to process, which might indicate that the thread that is processing it is stuck.

### Field Summary

### Fields inherited from class org.apache.catalina.valves.ValveBase

`asyncSupported, container, containerLog, next`

### Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

`mserver`

### 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 and Description
`StuckThreadDetectionValve()` Required to enable async support.

### Method Summary

Methods
`void` `backgroundProcess()` Execute a periodic task, such as reloading, etc.
`String` `getInfo()` Return descriptive information about this Valve implementation.
`long[]` `getStuckThreadIds()`
`String[]` `getStuckThreadNames()`
`int` `getThreshold()`
`protected void` `initInternal()` Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.
`void` `invoke(Request request, Response response)` The implementation-specific logic represented by this Valve.
`void` `setThreshold(int threshold)` Specify the threshold (in seconds) used when checking for stuck threads.

### Methods inherited from class org.apache.catalina.valves.ValveBase

`event, 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`

### Methods inherited from class org.apache.catalina.util.LifecycleBase

`addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### StuckThreadDetectionValve

    public StuckThreadDetectionValve()

Required to enable async support.

### 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

#### getThreshold

    public int getThreshold()

Returns:
  The current threshold in seconds
See Also:
  `setThreshold(int)`

#### initInternal

    protected void initInternal()
                         throws LifecycleException

Description copied from class: `LifecycleMBeanBase`
Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.

Overrides:
  `initInternal` in class `ValveBase`
Throws:
  `LifecycleException`

#### getInfo

    public String getInfo()

Return descriptive information about this Valve implementation.

Specified by:
  `getInfo` in interface `Valve`
Overrides:
  `getInfo` in class `ValveBase`

#### invoke

    public void invoke(Request request,
              Response response)
                throws IOException,
                       ServletException

The implementation-specific logic represented by this Valve. See the Valve description for the normal design patterns for this method.

This method MUST be provided by a subclass.

Specified by:
  `invoke` in interface `Valve`
Specified by:
  `invoke` in class `ValveBase`
Parameters:
  `request` - The servlet request to be processed
  `response` - The servlet response to be created
Throws:
  `IOException` - if an input/output error occurs
  `ServletException` - if a servlet error occurs

#### backgroundProcess

    public void backgroundProcess()

Description copied from class: `ValveBase`
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.

Specified by:
  `backgroundProcess` in interface `Valve`
Overrides:
  `backgroundProcess` in class `ValveBase`

#### getStuckThreadIds

    public long[] getStuckThreadIds()

#### getStuckThreadNames

    public String[] getStuckThreadNames()