Package lazyj
Class ThreadsMonitor
java.lang.Object
java.lang.Thread
lazyj.ThreadsMonitor
- All Implemented Interfaces:
- Runnable
This class is used to monitor servlet threads, killing the ones that run for longer than it was specified. See 
ExtendedServlet.getMaxRunTime() for more information on how to modify
 the maximum run time for a servlet.- Since:
- 2006-10-04
- Author:
- costing
- 
Nested Class SummaryNested classes/interfaces inherited from class java.lang.ThreadThread.State, Thread.UncaughtExceptionHandler
- 
Field SummaryFields inherited from class java.lang.ThreadMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidregister(lazyj.BoundedThreadContainer btc) Register a thread that must be allowed to run but for a limited amount of time.voidrun()The monitoring thread, takes the next thread (servlet) that ran for longer than expected and kills itstatic voidunregister(lazyj.BoundedThreadContainer btc) Remove a previously added wrapper.Methods inherited from class java.lang.ThreadactiveCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
- 
Method Details- 
runpublic void run()The monitoring thread, takes the next thread (servlet) that ran for longer than expected and kills it
- 
registerpublic static void register(lazyj.BoundedThreadContainer btc) Register a thread that must be allowed to run but for a limited amount of time. This is used by theExtendedServletwrapper to keep under control the servlets, but you could use it for any other thread.- Parameters:
- btc- the wrapper for the thread to be monitored
 
- 
unregisterpublic static void unregister(lazyj.BoundedThreadContainer btc) Remove a previously added wrapper. Use this when the thread correctly finishes the work. You should explicitly call this when the work is done because otherwise you will probably kill something else that could be running later under that thread, and you don't want this, right? :)- Parameters:
- btc-
 
 
-