|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.develop.trace.TraceSubsystemMediator
This class mediates between the Trace objects that send messages and the TraceMessageAcceptors that accept them. It has two key roles:
Determining which of the acceptors should get a particular message.
Setting the thresholds used to answer the above question.
Field Summary | |
static String[] |
acceptorNames
|
static int |
ADD
|
static int |
DEBUG
|
static String |
DEFAULT_NAME
|
(package private) boolean[] |
deferToDefaultThreshold
True if this subsystem's threshold is whatever "default"'s is. |
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 TraceMessageAcceptor[][] |
myAcceptors
The acceptors all mediators communicate with. |
private Vector |
myCaches
Specific Trace objects act as caches. |
private String |
mySubsystem
The subsystem that uses this mediator. |
private int[] |
myThresholds
The threshold to use. |
private boolean[] |
myTimingBooleans
Whether timing has been turned on for a particular acceptor. |
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
|
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 | |
(package private) |
TraceSubsystemMediator(String aSubsystem,
int[] someThresholds,
TraceMessageAcceptor[][] someAcceptors)
Create a TraceSubsystemMediator. |
Method Summary | |
void |
accept(TraceMessage message)
Accept a message and distribute it to all the acceptors who accept messages of that level. |
private int |
commonThreshold()
The common threshold is the most detailed (lowest). |
private boolean |
commonTiming()
The common timing is true if any acceptor times. |
(package private) void |
newCache(Trace newCache)
This routine is called when a new Trace object is to be added to this mediator. |
(package private) void |
setOneThreshold(int acceptorIndex,
int newValue,
int reason)
Set a particular acceptor's threshold, either to track the default or to have its own particular value. |
(package private) void |
setTiming(int acceptorIndex,
boolean newValue)
Set a particular acceptor's timing value. |
private void |
updateOneThresholdCache(Trace tr,
int commonThreshold)
Update tracing thresholds. |
private void |
updateOneTimingCache(Trace tr,
boolean commonTiming)
Update timing thresholds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final String mySubsystem
final boolean[] deferToDefaultThreshold
Note that this variable can be accessed outside this class.
Having knowledge of who's tracking the default be shared between this class and TraceController is kind of slimy, but there's not enough of a gain in fiddling with it.
private int[] myThresholds
private final boolean[] myTimingBooleans
private final TraceMessageAcceptor[][] myAcceptors
private final Vector myCaches
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 |
TraceSubsystemMediator(String aSubsystem, int[] someThresholds, TraceMessageAcceptor[][] someAcceptors)
aSubsystem
- the subsystem this mediates.Method Detail |
public void accept(TraceMessage message)
This method represents the second level of filtering by priority. The first level is by the original user code, which uses the Trace object booleans to do its own filtering. TraceMessageAcceptors don't do any filtering.
Note: This method represents the transition from inside the vat to outside the vat. Therefore the message's timestamp is added here.
private int commonThreshold()
private boolean commonTiming()
void newCache(Trace newCache)
void setOneThreshold(int acceptorIndex, int newValue, int reason)
acceptorIndex
- which acceptor to changenewValue
- to what value. Note that default values are no
different from specific values.void setTiming(int acceptorIndex, boolean newValue)
acceptorIndex
- which acceptor to changenewValue
- to what value.private void updateOneThresholdCache(Trace tr, int commonThreshold)
A trace object is used as a cache for quick checking of tracing thresholds. This routine updates that cache.
Why, you ask, does this method rudely bash on variables within the Trace object, instead of calling a method to set them? It's because the Trace object is inside the vat, and no object inside the vat is allowed to change those values, because they are reachable through static state.
tr
- the trace object itself.commonThreshold
- the lowest threshold of all the acceptors.private void updateOneTimingCache(Trace tr, boolean commonTiming)
tr
- the trace object itself.commonTiming
- the value to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |