io.undertow.server.handlers

## Class StuckThreadDetectionHandler

- java.lang.Object
- - io.undertow.server.handlers.StuckThreadDetectionHandler

All Implemented Interfaces:
  HttpHandler

    public class StuckThreadDetectionHandler
    extends Object
    implements HttpHandler

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. Based on code proposed by TomLu in Bugzilla entry #50306

Author:
  slaurent

### Nested Class Summary

Nested Classes
`static class` `StuckThreadDetectionHandler.Builder`
`static class` `StuckThreadDetectionHandler.Wrapper`

### Field Summary

Fields
`static int` `DEFAULT_THRESHOLD`

### Constructor Summary

Constructors
Constructor and Description
`StuckThreadDetectionHandler(HttpHandler next)`
`StuckThreadDetectionHandler(int threshold, HttpHandler next)`

### Method Summary

All Methods Instance Methods Concrete Methods
`long[]` `getStuckThreadIds()`
`int` `getThreshold()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`String` `toString()`

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

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

### Field Detail

#### DEFAULT_THRESHOLD

    public static final int DEFAULT_THRESHOLD

See Also:
  Constant Field Values

### Constructor Detail

#### StuckThreadDetectionHandler

    public StuckThreadDetectionHandler(HttpHandler next)

#### StuckThreadDetectionHandler

    public StuckThreadDetectionHandler(int threshold,
                                       HttpHandler next)

### Method Detail

#### getThreshold

    public int getThreshold()

Returns:
  The current threshold in seconds

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### getStuckThreadIds

    public long[] getStuckThreadIds()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`