| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | activeThreads
The only references we keep to actual running Thread objects are in this Map (which is automatically cleaned in invoke()s finally clause). |
| private final Queue | |
| private AtomicLong | interruptedThreadsCount
Keeps count of the number of stuck threads that have been interrupted |
| private int | interruptThreadThreshold
In seconds. |
| private static final Log | log
Logger
|
| private static final StringManager | sm
The string manager for this package.
|
| private final AtomicInteger | stuckCount
Keeps count of the number of stuck threads detected |
| private int | threshold
In seconds. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | backgroundProcess()
Overrides org. Implements org. Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. |
| public long | |
| public int | |
| public int | |
| public long[] | |
| public String[] | |
| public int | |
| protected void | initInternal()
Overrides org. Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method. |
| public void | invoke(Request
The servlet request to be processed request, Response The servlet response to be created response)Implements org. Perform request processing as required by this Valve. |
| private void | notifyStuckThreadCompleted(StuckThreadDetectionValve.
|
| private void | notifyStuckThreadDetected(StuckThreadDetectionValve.
|
| public void | setInterruptThreadThreshold(int
The new thread interruption threshold in seconds interruptThreadThreshold)Specifies the threshold (in seconds) before stuck threads are interrupted. |
| public void | setThreshold(int
The new threshold in seconds threshold)Specifies the threshold (in seconds) used when checking for stuck threads. |
| activeThreads | back to summary |
|---|---|
| private final Map<Long, StuckThreadDetectionValve. The only references we keep to actual running Thread objects are in this Map (which is automatically cleaned in invoke()s finally clause). That way, Threads can be GC'ed, even though the Valve still thinks they are stuck (caused by a long monitor interval) | |
| completedStuckThreadsQueue | back to summary |
|---|---|
| private final Queue<StuckThreadDetectionValve. | |
| interruptedThreadsCount | back to summary |
|---|---|
| private AtomicLong interruptedThreadsCount Keeps count of the number of stuck threads that have been interrupted | |
| interruptThreadThreshold | back to summary |
|---|---|
| private int interruptThreadThreshold In seconds. Default is -1 to disable interruption. | |
| log | back to summary |
|---|---|
| private static final Log log Hides org. Logger | |
| sm | back to summary |
|---|---|
| private static final StringManager sm Hides org. The string manager for this package. | |
| stuckCount | back to summary |
|---|---|
| private final AtomicInteger stuckCount Keeps count of the number of stuck threads detected | |
| threshold | back to summary |
|---|---|
| private int threshold In seconds. Default 600 (10 minutes). | |
| StuckThreadDetectionValve | back to summary |
|---|---|
| public StuckThreadDetectionValve() Required to enable async support. | |
| backgroundProcess | back to summary |
|---|---|
| public void backgroundProcess() Overrides org. Implements org. Doc from org. 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. The default implementation is NO-OP.
| |
| getInterruptedThreadsCount | back to summary |
|---|---|
| public long getInterruptedThreadsCount() | |
| getInterruptThreadThreshold | back to summary |
|---|---|
| public int getInterruptThreadThreshold() | |
| getStuckThreadCount | back to summary |
|---|---|
| public int getStuckThreadCount() | |
| getStuckThreadIds | back to summary |
|---|---|
| public long[] getStuckThreadIds() | |
| getStuckThreadNames | back to summary |
|---|---|
| public String[] getStuckThreadNames() | |
| getThreshold | back to summary |
|---|---|
public int getThreshold()
| |
| initInternal | back to summary |
|---|---|
| protected void initInternal() throws LifecycleException Overrides org. Doc from org. Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.
| |
| invoke | back to summary |
|---|---|
| public void invoke(Request request, Response response) throws IOException, ServletException Implements org. Doc from org. Perform request processing as required by this Valve. An individual Valve MAY perform the following actions, in the specified order:
A Valve MUST NOT do any of the following things:
| |
| notifyStuckThreadCompleted | back to summary |
|---|---|
| private void notifyStuckThreadCompleted(StuckThreadDetectionValve. | |
| notifyStuckThreadDetected | back to summary |
|---|---|
| private void notifyStuckThreadDetected(StuckThreadDetectionValve. | |
| setInterruptThreadThreshold | back to summary |
|---|---|
| public void setInterruptThreadThreshold(int interruptThreadThreshold) Specifies the threshold (in seconds) before stuck threads are interrupted. If <=0, the interruption is disabled. The default is -1. If >=0, the value must actually be >= threshold.
| |
| setThreshold | back to summary |
|---|---|
| public void setThreshold(int threshold) Specifies the threshold (in seconds) used when checking for stuck threads. If <=0, the detection is disabled. The default is 600 seconds.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final String | |
| private final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public String | |
| public long |
| threadId | back to summary |
|---|---|
| private final long threadId | |
| threadName | back to summary |
|---|---|
| private final String threadName | |
| totalActiveTime | back to summary |
|---|---|
| private final long totalActiveTime | |
| CompletedStuckThread | back to summary |
|---|---|
| pack-priv CompletedStuckThread(Thread thread, long totalActiveTime) | |
| getId | back to summary |
|---|---|
| public long getId() | |
| getName | back to summary |
|---|---|
| public String getName() | |
| getTotalActiveTime | back to summary |
|---|---|
| public long getTotalActiveTime() | |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | interrupted
Set to true after the thread is interrupted. |
| private final Semaphore | interruptionSemaphore
Semaphore to synchronize the stuck thread with the background-process thread. |
| private final String | |
| private final long | |
| private final AtomicInteger | |
| private final Thread | thread
Reference to the thread to get a stack trace from background task |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public String | |
| public Date | |
| public Thread | |
| public boolean | |
| pack-priv boolean | |
| public StuckThreadDetectionValve. | |
| public boolean | |
| public boolean |
| interrupted | back to summary |
|---|---|
| private boolean interrupted Set to true after the thread is interrupted. No need to make it volatile since it is accessed right after acquiring the semaphore. | |
| interruptionSemaphore | back to summary |
|---|---|
| private final Semaphore interruptionSemaphore Semaphore to synchronize the stuck thread with the background-process thread. It's not used if the interruption feature is not active. | |
| requestUri | back to summary |
|---|---|
| private final String requestUri | |
| start | back to summary |
|---|---|
| private final long start | |
| state | back to summary |
|---|---|
| private final AtomicInteger state | |
| thread | back to summary |
|---|---|
| private final Thread thread Reference to the thread to get a stack trace from background task | |
| MonitoredThread | back to summary |
|---|---|
| pack-priv MonitoredThread(Thread thread, String requestUri, boolean interruptible) | |
| getActiveTimeInMillis | back to summary |
|---|---|
| public long getActiveTimeInMillis() | |
| getRequestUri | back to summary |
|---|---|
| public String getRequestUri() | |
| getStartTime | back to summary |
|---|---|
| public Date getStartTime() | |
| getThread | back to summary |
|---|---|
| public Thread getThread() | |
| interruptIfStuck | back to summary |
|---|---|
| public boolean interruptIfStuck(long interruptThreadThreshold) | |
| isMarkedAsStuck | back to summary |
|---|---|
| pack-priv boolean isMarkedAsStuck() | |
| markAsDone | back to summary |
|---|---|
| public StuckThreadDetectionValve. | |
| markAsStuckIfStillRunning | back to summary |
|---|---|
| public boolean markAsStuckIfStillRunning() | |
| wasInterrupted | back to summary |
|---|---|
| public boolean wasInterrupted() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final StuckThreadDetectionValve. | |
| public static final StuckThreadDetectionValve. | |
| public static final StuckThreadDetectionValve. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static StuckThreadDetectionValve. | |
| public static StuckThreadDetectionValve. |
| DONE | back to summary |
|---|---|
| public static final StuckThreadDetectionValve. | |
| RUNNING | back to summary |
|---|---|
| public static final StuckThreadDetectionValve. | |
| STUCK | back to summary |
|---|---|
| public static final StuckThreadDetectionValve. | |
| MonitoredThreadState | back to summary |
|---|---|
| private MonitoredThreadState() | |
| valueOf | back to summary |
|---|---|
| public static StuckThreadDetectionValve. | |
| values | back to summary |
|---|---|
| public static StuckThreadDetectionValve. | |