edu.mit.ai.psg.traveler
Class TraceRecorderObservable

java.lang.Object
  |
  +--edu.mit.ai.psg.traveler.TraceRecorderDefault
        |
        +--edu.mit.ai.psg.traveler.TraceRecorderObservable

public class TraceRecorderObservable
extends TraceRecorderDefault
implements ObservableBiographyRecorder

An alternate trace recorder that produces observable call records and provides means to observe additions to biographies. Use this instead of TraceRecorderDefault when you want to observe the records while the program is in progress (e.g., so a display can be notified and updated when new items are added to biography, or new children are added to an activity or call). Observable recording does more work to track and notify observers as additions are made, so it is less efficient than default recording. TraceRecorderObservable overrides TraceRecorderDefault, to create CallRecordObservable instead of CallRecordDefault. It also implements ObservableBiographyRecorder so that biographies can be observed. Caution:TraceRecorderObservable should not be used if any object's toString method (or any method called by its toString() method) traces synchronization, because it will cause an endless cycle: displaying its biography will generate calls to its toString() method, which will cause the biography to be extended, which will trigger calling the toString method again...

See Also:
Trace, TraceRecorder

Constructor Summary
TraceRecorderObservable()
           
 
Method Summary
 void addBiographyObserver(Object target, ChangeObserver observer)
          arrange to be notified as follows: record added to target's biography: observer.notifyAdded(target, record)
 void addEntryToBiography(SynchronizationRecord record)
          augmented to inform biography observers that target biography changed.
 void addExitToBiography(SynchronizationRecord record)
          augmented to inform biography observers that target biography changed.
protected  void fireBiographyObservers(Object target, ActivityRecord record)
           
 boolean isReadOnly(Object target)
          returns false; any Object can be target of synchronized block and a target of biography by this TraceRecorderObservable
protected  CallRecord makeCallRecord(Object target, Member member, Object[] parameters)
          Creates a CallRecordObservable
protected  ActivityRecord makeStringRecord(String string)
          Creates a StringRecordObservable
protected  SynchronizationRecord makeSynchronizationRecord(Object target, Member member)
          Creates a SynchronizationRecordObservable
 void removeBiographyObserver(Object target, ChangeObserver observer)
           
 
Methods inherited from class edu.mit.ai.psg.traveler.TraceRecorderDefault
beganSynchronization, beginning, clearBiographies, clearBiography, clearSynchronizationHolders, doing, doing, enteredSynchronization, entering, exitting, getBiography, getCurrentRecord, getSynchronizationHolder, getThreadOutermostRecord, invoking, received, returning, returningVoid, setCurrentRecord, throwing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceRecorderObservable

public TraceRecorderObservable()
Method Detail

makeCallRecord

protected CallRecord makeCallRecord(Object target,
                                    Member member,
                                    Object[] parameters)
Creates a CallRecordObservable
Overrides:
makeCallRecord in class TraceRecorderDefault

makeSynchronizationRecord

protected SynchronizationRecord makeSynchronizationRecord(Object target,
                                                          Member member)
Creates a SynchronizationRecordObservable
Overrides:
makeSynchronizationRecord in class TraceRecorderDefault

makeStringRecord

protected ActivityRecord makeStringRecord(String string)
Creates a StringRecordObservable
Overrides:
makeStringRecord in class TraceRecorderDefault

addBiographyObserver

public void addBiographyObserver(Object target,
                                 ChangeObserver observer)
arrange to be notified as follows:
Specified by:
addBiographyObserver in interface ObservableBiographyRecorder

removeBiographyObserver

public void removeBiographyObserver(Object target,
                                    ChangeObserver observer)
Specified by:
removeBiographyObserver in interface ObservableBiographyRecorder

fireBiographyObservers

protected void fireBiographyObservers(Object target,
                                      ActivityRecord record)

isReadOnly

public boolean isReadOnly(Object target)
returns false; any Object can be target of synchronized block and a target of biography by this TraceRecorderObservable
Specified by:
isReadOnly in interface ObservableBiographyRecorder

addEntryToBiography

public void addEntryToBiography(SynchronizationRecord record)
augmented to inform biography observers that target biography changed. Should be called from within synchronized region protecting access to target so that biography shows changes in same order threads accessed target.
Overrides:
addEntryToBiography in class TraceRecorderDefault
Tags copied from class: TraceRecorderDefault
See Also:
TraceRecorder.addEntryToBiography(edu.mit.ai.psg.traveler.SynchronizationRecord)

addExitToBiography

public void addExitToBiography(SynchronizationRecord record)
augmented to inform biography observers that target biography changed. Should be called from within synchronized region protecting access to target so that biography shows changes in same order threads accessed target.
Overrides:
addExitToBiography in class TraceRecorderDefault
Tags copied from class: TraceRecorderDefault
See Also:
TraceRecorder.addExitToBiography(edu.mit.ai.psg.traveler.SynchronizationRecord)

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu