public class GuardSupport extends Base
| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
GuardSupport.Context
Base implementation for GuardContext's used by GuardSupport. 
 | 
Base.LoggingWriter, Base.StackFrame| Modifier and Type | Field and Description | 
|---|---|
protected static long | 
GUARDIAN_EARLY_THRESHOLD
The threshold before which than which a guardian considers itself early in checking its guardables. 
 | 
protected static long | 
GUARDIAN_LATE_THRESHOLD
The threshold past which a guardian considers itself late in checking its guardables. 
 | 
protected static long | 
GUARDIAN_LOG_INTERVAL
The minimum interval at which the Guardian should log thread dumps. 
 | 
static long | 
GUARDIAN_MAX_CHECK_INTERVAL
The maximum interval at which the Guardian thread should call check() to verify its guardables. 
 | 
protected GuardSupport.Context[] | 
m_aGuardContext
Array of GuardContexts for the registered Guardables. 
 | 
protected int | 
m_cGuardable
The number of registered Guardables. 
 | 
protected Guardian | 
m_guardian
The Guardian that is managing this GuardSupport. 
 | 
protected long | 
m_ldtNextCheck
The next time at which the Guardables should be checked. 
 | 
protected static ThreadLocal | 
m_tlContext
ThreadLocal containing the GuardContext associated with the current thread. 
 | 
protected static AtomicLong | 
s_atomicLogTime
Atomic counter containing the last log time stamp. 
 | 
protected static ThreadMXBean | 
s_beanThread
MXBean for the thread system 
 | 
| Constructor and Description | 
|---|
GuardSupport(Guardian guardian)
Construct a GuardSupport for the specified Guardian. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Guardian.GuardContext | 
add(Guardable guardable, long cMillis, float flPctRecover)
Add the specified guardable to the set of Guardables managed by this manager, subject to the specified service parameters. 
 | 
long | 
check()
Check the registered Guardable objects for timeout, taking appropriate action and calculate the timestamp when the next check should be performed. 
 | 
protected static Set<Long> | 
collectDeadlockedIds()
Collect the deadlocked thread ids. 
 | 
static void | 
collectLockedSyncs(ThreadInfo infoThread, StringBuilder sbTrace)
Collect locked synchronizers for a given thread. 
 | 
static void | 
collectStackTrace(ThreadInfo infoThread, StringBuilder sbTrace)
Collect stack trace for a given thread. 
 | 
static void | 
collectThreadHeader(ThreadInfo infoThread, StringBuilder sbTrace, boolean fDeadlocked)
Collect the header information for a given thread. 
 | 
int | 
getGuardableCount()
Return the number of Guardables that are registered with this GuardSupport. 
 | 
protected GuardSupport.Context[] | 
getGuardContexts()
Return the array of GuardContext objects for the Guardables managed by this GuardSupport. 
 | 
protected Guardian | 
getGuardian()
Return the Guardian that manages this GuardSupport. 
 | 
long | 
getNextCheckTime()
Return the next time at which the Guardables should be checked. 
 | 
static Guardian.GuardContext | 
getThreadContext()
Obtain the GuardContext associated with the current thread. 
 | 
static String | 
getThreadDump()
Get the full thread dump. 
 | 
static void | 
heartbeat()
Issue a heartbeat on the GuardContext associated with the current thread. 
 | 
static void | 
heartbeat(long cMillis)
Issue a heartbeat of the specified duration on the GuardContext associated with the current thread. 
 | 
protected GuardSupport.Context | 
instantiateContext(Guardable guardable, long cMillis, float flPctRecover)  | 
static void | 
logStackTraces()
Collect stack traces and synchronization information for all running threads and write them to the error log. 
 | 
void | 
release()
Release the Guardables managed by this GuardSupport. 
 | 
void | 
remove(Guardable guardable)
Remove the specified Guardable from the set of Guardables managed by this manager. 
 | 
protected void | 
setGuardableCount(int cGuardable)
Set the number of Guardables that are registered with this GuardSupport. 
 | 
protected void | 
setGuardContexts(GuardSupport.Context[] aGuardContext)
Set the array of GuardContext objects for the Guardables that are managed by this GuardSupport. 
 | 
protected void | 
setNextCheckTime(long ldtNextCheck)
Set the next time at which the Guardables should be checked. 
 | 
static void | 
setThreadContext(Guardian.GuardContext context)
Associate the specified GuardContext with the current thread. 
 | 
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, waitpublic static final long GUARDIAN_MAX_CHECK_INTERVAL
protected static final long GUARDIAN_LATE_THRESHOLD
protected static final long GUARDIAN_EARLY_THRESHOLD
protected static final long GUARDIAN_LOG_INTERVAL
protected GuardSupport.Context[] m_aGuardContext
protected int m_cGuardable
protected Guardian m_guardian
protected long m_ldtNextCheck
protected static ThreadLocal m_tlContext
protected static AtomicLong s_atomicLogTime
protected static ThreadMXBean s_beanThread
public GuardSupport(Guardian guardian)
guardian - the guardian managing this GuardSupportprotected GuardSupport.Context[] getGuardContexts()
protected void setGuardContexts(GuardSupport.Context[] aGuardContext)
aGuardContext - the array of managed GuardContext objectsprotected Guardian getGuardian()
public long getNextCheckTime()
protected void setNextCheckTime(long ldtNextCheck)
ldtNextCheck - the next time at which the Guardables should be checkedpublic Guardian.GuardContext add(Guardable guardable, long cMillis, float flPctRecover)
guardable - the Guardable object to be managedcMillis - the timeout for the specified GuardableflPctRecover - the percentage of the timeout after which to attempt recovery of the Guardable; 0 < flPctRecover <eq; 1.0public void remove(Guardable guardable)
guardable - the guardable to removepublic int getGuardableCount()
protected void setGuardableCount(int cGuardable)
cGuardable - the number of registered Guardable objectspublic long check()
getNextCheckTime() method.public void release()
protected GuardSupport.Context instantiateContext(Guardable guardable, long cMillis, float flPctRecover)
guardable - the Guardable object to be managedcMillis - the timeout for the specified GuardableflPctRecover - the percentage of the timeout after which to attempt recovery of the Guardable; 0 < flPctRecover <eq; 1.0public static Guardian.GuardContext getThreadContext()
public static void setThreadContext(Guardian.GuardContext context)
context - the GuardContext to associate with the current threadpublic static void heartbeat()
public static void heartbeat(long cMillis)
cMillis - the number of milliseconds to heartbeat forpublic static void logStackTraces()
public static String getThreadDump()
public static void collectThreadHeader(ThreadInfo infoThread, StringBuilder sbTrace, boolean fDeadlocked)
infoThread - the ThreadInfo that the thread is associated withsbTrace - the StringBuilder to append the info tofDeadlocked - true iff the thread is in deadlockpublic static void collectLockedSyncs(ThreadInfo infoThread, StringBuilder sbTrace)
infoThread - the ThreadInfo that the thread is associated withsbTrace - the StringBuilder to append the info topublic static void collectStackTrace(ThreadInfo infoThread, StringBuilder sbTrace)
infoThread - the ThreadInfo that the thread is associated withsbTrace - the StringBuilder to append the info to