|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.develop.trace.TraceController
Untamed: The single trace controller manages all the trace classes. Most notably, it has one TraceSubsystemMediator for each subsystem being traced. A TraceSubsystemMediator may mediate several Trace objects. Messages sent to those trace objects are forwarded to the mediator. The mediator, under the control of the TraceController, sends the message on to TraceMessageAcceptors that are ready to accept messages. The two current TraceMessageAcceptors are the TraceLog and the TraceBuffer. Once upon a time, there was a third, the TraceDisplay, which would echo to the screen the contents of the TraceBuffer. However, that proved impractical in the current build environment.
Field Summary | |
static String[] |
acceptorNames
|
static int |
ADD
|
static int |
DEBUG
|
(package private) static boolean |
debugTraceCaller
Set if stack parsing is to be debugged. |
static String |
DEFAULT_NAME
|
static int |
ERROR
The different trace thresholds. |
static int |
EVENT
|
static int |
FOR_SUBSYSTEM
|
static int |
FROM_DEFAULT
When referring to thresholds, are we talking about those from the default thresholds, or ones specific to a subsystem? XXX These could be interned strings, but interning didn't work right in 1.0.4. |
static int |
IRRELEVANT
|
static int |
LOG
This identifies the TraceMessageAcceptor used for the on-disk log. |
static String |
LOG_EXTENSION
|
static int |
MAX_THRESHOLD
|
private static TraceMessageAcceptor[][] |
myAcceptors
The complete list of acceptors, for use by mediators. |
private static TraceBuffer |
myBuffer
The in-core trace buffer. |
private static int[] |
myDefaultThresholds
Trace thresholds that apply to subsystems that haven't been given specific values. |
private static TraceLog |
myLog
The on-disk log. |
private static boolean |
myStarted
Have we already been initialized? |
private static TraceErrorWatcher |
myTraceErrorWatcher
This object, if non-null, is informed when notifyFatal or notifyOptional is called. |
private static Hashtable |
myTraceMediators
The list of TraceSubsystemMediators for the subsystems being traced. |
static int |
NUM_ACCEPTORS
The number of different types of TraceMessageAcceptors. |
static int |
OVERWRITE
|
static String[] |
reasonNames
|
static long |
SMALLEST_LOG_SIZE_THRESHOLD
|
static int |
STARTING_LOG_BACKUP_ACTION
|
static File |
STARTING_LOG_DIR
|
static long |
STARTING_LOG_SIZE_THRESHOLD
|
static String |
STARTING_LOG_TAG
|
static int |
STARTING_LOG_THRESHOLD
|
static boolean |
STARTING_LOG_WRITE
|
static int |
STARTING_TRACE_BUFFER_SIZE
|
static int |
STARTING_TRACE_THRESHOLD
|
private static Object |
synchronizationObject
Synchronized static methods are prone to deadlocks in Sun's JVM. |
static int |
TIMING
As a late addition, there's a "timing" boolean that can be set orthogonally from the thresholds. |
static int |
TRACE
This identifies the TraceMessageAcceptor used for the in-core trace and its associated window. |
static String |
UNLIMITED_NAME
|
static int |
USAGE
|
static int |
VERBOSE
|
static String |
version
|
static int |
WARNING
|
static int |
WORLD
|
Constructor Summary | |
TraceController()
Enabled: |
Method Summary | |
static void |
changeDisplay(boolean showIt)
Enabled: Request that the trace buffer be visible in a window. |
private static void |
changeOneDefault(int acceptorIndex,
int newThreshold)
Change the default threshold for some TraceMessageAcceptor. |
private static void |
changeOneSubsystem(int acceptorIndex,
String subsystem,
String value)
Change a specific TraceMessageMediator to have its own trace priority threshold OR change it to resume tracking the default. |
static void |
debugTraceCaller()
Enabled: For debugging purposes, dump each java runtime stack as it's parsed. |
static void |
dumpBufferToLog()
Enabled: Take the contents of the internal trace buffer and add them to the on-disk log. |
static void |
errorWatcher(TraceErrorWatcher aTraceErrorWatcher,
boolean add)
Enabled: Register or unregister as a TraceErrorWatcher. |
private static TraceSubsystemMediator |
findOrCreateMediator(String name)
Find a TraceSubsystemMediator matching the given name. |
static void |
mayUseUI()
Enabled: Invoke this to tell the TraceController that a display is ready to use. |
(package private) static void |
newTrace(Trace requester,
String subsystem)
This is called by a Trace constructor to inform the Trace Controller that it exists. |
static void |
notifyFatal()
Enabled: Notify a user that a fatal error has happened. |
static void |
notifyOptional()
Enabled: If the user wants to hear about nonfatal bugs, notify her. |
static void |
setProperties(Properties p)
Enabled: This method updates a trace controller from a given set of properties. |
static void |
setProperty(String key,
String value)
Enabled: If the given Key names a tracing property, process its value. |
private static void |
setTiming(int acceptorIndex,
String afterFirstUnderbar,
String value)
Set the timing value of a given subsystem's acceptor. |
static void |
start()
Enabled: Use this constructor when you have no launch-time properties. |
static void |
start(Properties p)
Enabled: This routine is used to start the Trace Controller. |
private static boolean |
timingProperty(String afterFirstUnderbar)
Is this a timing control statement like "TraceBuffer_ui_timing=true"? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Hashtable myTraceMediators
private static final int[] myDefaultThresholds
private static final TraceLog myLog
static boolean debugTraceCaller
private static final TraceBuffer myBuffer
private static boolean myStarted
private static final TraceMessageAcceptor[][] myAcceptors
private static TraceErrorWatcher myTraceErrorWatcher
private static final Object synchronizationObject
public static final String version
public static final int LOG
public static final int TRACE
public static final int NUM_ACCEPTORS
public static final String[] acceptorNames
public static final int ERROR
public static final int WARNING
public static final int WORLD
public static final int USAGE
public static final int EVENT
public static final int DEBUG
public static final int VERBOSE
public static final int MAX_THRESHOLD
public static final int TIMING
public static final int FROM_DEFAULT
public static final int FOR_SUBSYSTEM
public static final String[] reasonNames
public static final int STARTING_TRACE_BUFFER_SIZE
public static final int STARTING_TRACE_THRESHOLD
public static final long STARTING_LOG_SIZE_THRESHOLD
public static final long SMALLEST_LOG_SIZE_THRESHOLD
public static final int STARTING_LOG_THRESHOLD
public static final boolean STARTING_LOG_WRITE
public static final int IRRELEVANT
public static final int ADD
public static final int OVERWRITE
public static final int STARTING_LOG_BACKUP_ACTION
public static final File STARTING_LOG_DIR
public static final String STARTING_LOG_TAG
public static final String LOG_EXTENSION
public static final String DEFAULT_NAME
public static final String UNLIMITED_NAME
Constructor Detail |
public TraceController()
Method Detail |
public static void changeDisplay(boolean showIt)
private static void changeOneDefault(int acceptorIndex, int newThreshold)
private static void changeOneSubsystem(int acceptorIndex, String subsystem, String value)
public static void dumpBufferToLog()
public static void debugTraceCaller()
public static void errorWatcher(TraceErrorWatcher aTraceErrorWatcher, boolean add)
This is kind of a stupid interface. I didn't think it through before "publishing" it.
aTraceErrorWatcher
- the object to be informed of an error.add
- true if the object is to be added, false if it's to
be removed. It's not an error to add without first removing, or
to remove without first adding, but it does provoke a warning.private static TraceSubsystemMediator findOrCreateMediator(String name)
public static void mayUseUI()
static void newTrace(Trace requester, String subsystem)
public static void notifyFatal()
If this method is called before a TraceErrorWatcher has registered, it's not clear what the best thing to do is. For the moment, we log that as an error and return, in the hopes that the system will hobble along a bit further to the point where a watcher registers and a later notifyFatal causes the user to be notified.
public static void notifyOptional()
It is a (non-fatal) error if no object has registered as a TraceErrorWatcher.
public static void setProperties(Properties p)
IMPORTANT: The properties are processed in an unpredictable order.
public static void setProperty(String key, String value)
It is an error for the value to be null.
private static void setTiming(int acceptorIndex, String afterFirstUnderbar, String value)
acceptorIndex
- the acceptor.afterFirstUnderbar
- is of the form value
- is "on", "off", "true", or "false".public static void start(Properties p)
Note: This routine may be called before the user interface is available. This allows on-disk logging to be useful in the case the system fails before the UI is initialized.
p
- the initial set of properties provided by the user.
They override the defaults. They may be changed later.public static void start()
private static boolean timingProperty(String afterFirstUnderbar)
afterFirstUnderbar
- text after first underbar.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |