edu.mit.ai.psg.traveler
Class SynchronizationRecordDefault

java.lang.Object
  |
  +--edu.mit.ai.psg.traveler.ActivityRecordBase
        |
        +--edu.mit.ai.psg.traveler.SynchronizationRecordDefault
Direct Known Subclasses:
CallRecordDefault, SynchronizationRecordObservable

public class SynchronizationRecordDefault
extends ActivityRecordBase
implements SynchronizationRecord

Default implementation of SynchronizationRecord. This class can be used directly for synchronized blocks; a derived class can be used for synchronized methods. SynchronizationRecordDefault.Entry is default Entry record; SynchronizationRecordDefault.Exit is default Exit record.

See Also:
SynchronizationRecord

Inner Class Summary
static class SynchronizationRecordDefault.Entry
          default class for recording entry into synchronization in a biography
static class SynchronizationRecordDefault.Exit
          default class for recording exit from synchronization in a biography
 
Inner classes inherited from class edu.mit.ai.psg.traveler.SynchronizationRecord
SynchronizationRecord.Entry, SynchronizationRecord.Exit
 
Field Summary
protected  Member myMember
           
protected  Object myTargetNow
           
protected  Object myTargetThen
           
 
Fields inherited from class edu.mit.ai.psg.traveler.ActivityRecordBase
parent
 
Constructor Summary
SynchronizationRecordDefault(Object target)
           
SynchronizationRecordDefault(Object target, Member inMember)
           
 
Method Summary
 void addSynchronizationChild(SynchronizationRecord child)
          add record of nested/recursive call for synchronization e.g., a nested synchronized block or wait.
 SynchronizationRecord.Entry addSynchronizationEntry()
          Called by a TraceRecorder when adding entry for this activity to target's biography.
 SynchronizationRecord.Exit addSynchronizationExit()
          Called by a TraceRecorder when adding exit for this activity to target's biography.
 void finished()
          Trims child list (or sets to null if empty).
 Member getMember()
           
 List getSynchronizationChildren()
          synchronization children are SynchronizationRecords for recursive (possibly indirect) synchronizing or waiting
 SynchronizationRecord.Entry getSynchronizationEntry()
          returns record of entering synchronization for this activity.
 SynchronizationRecord.Exit getSynchronizationExit()
          returns record of exitting synchronization for this activity.
 SynchronizationRecord getSynchronizationParent()
           
 Object getTargetNow()
          return current the target of the sychronization as it is now, or null if call invoked a static method or constructor.
 Object getTargetThen()
          return a clone of target as it was when record was created, or null if target was not cloned.
 boolean isSynchronized()
          returns true;
 boolean isSynchronizedWait()
          returns false
protected  SynchronizationRecord.Entry makeSynchronizationEntryRecord()
          overridable method; returns new SynchronizationRecordDefault.Entry
protected  SynchronizationRecord.Exit makeSynchronizationExitRecord()
          overridable method; returns new SynchronizationRecordDefault.Exit
 void setSynchronizationParent(SynchronizationRecord syncParent)
          called by addSynchronizationChild(edu.mit.ai.psg.traveler.SynchronizationRecord)
 String toString()
          returns "(synchronized(target) in member)"
 
Methods inherited from class edu.mit.ai.psg.traveler.ActivityRecordBase
addChild, addThreadedChild, cloneObject, ensureListValue, getChildren, getChildrenInThread, getParent, getProperty, getThreadedChildren, isFinished, putProperty, removeProperty, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myTargetNow

protected Object myTargetNow

myTargetThen

protected Object myTargetThen

myMember

protected Member myMember
Constructor Detail

SynchronizationRecordDefault

public SynchronizationRecordDefault(Object target,
                                    Member inMember)
Parameters:
target - is the object on which activity is synchronizing
inMember - is method or constructor in which synchronization is occuring, or null if in static initializer

SynchronizationRecordDefault

public SynchronizationRecordDefault(Object target)
Method Detail

isSynchronized

public boolean isSynchronized()
returns true;
Specified by:
isSynchronized in interface SynchronizationRecord

isSynchronizedWait

public boolean isSynchronizedWait()
returns false
Specified by:
isSynchronizedWait in interface SynchronizationRecord
Tags copied from interface: SynchronizationRecord
See Also:
Object.wait()

getTargetNow

public Object getTargetNow()
Description copied from interface: SynchronizationRecord
return current the target of the sychronization as it is now, or null if call invoked a static method or constructor.
Specified by:
getTargetNow in interface SynchronizationRecord

getTargetThen

public Object getTargetThen()
Description copied from interface: SynchronizationRecord
return a clone of target as it was when record was created, or null if target was not cloned.
Specified by:
getTargetThen in interface SynchronizationRecord

getMember

public Member getMember()

getSynchronizationEntry

public SynchronizationRecord.Entry getSynchronizationEntry()
Description copied from interface: SynchronizationRecord
returns record of entering synchronization for this activity. returns null if doesn't exist.
Specified by:
getSynchronizationEntry in interface SynchronizationRecord

getSynchronizationExit

public SynchronizationRecord.Exit getSynchronizationExit()
Description copied from interface: SynchronizationRecord
returns record of exitting synchronization for this activity. returns null if doesn't exist.
Specified by:
getSynchronizationExit in interface SynchronizationRecord

addSynchronizationEntry

public SynchronizationRecord.Entry addSynchronizationEntry()
Description copied from interface: SynchronizationRecord
Called by a TraceRecorder when adding entry for this activity to target's biography. Initializes, adds, and returns a synchronization entry record for target's biography (entry must be first child of this activity in thread).
Specified by:
addSynchronizationEntry in interface SynchronizationRecord
Tags copied from interface: SynchronizationRecord
Throws:
IllegalStateException - if not SynchronizationRecord.isSynchronized() or SynchronizationRecord.isSynchronizedWait(), or if this already has an entry.
See Also:
SynchronizationRecord.getSynchronizationEntry()

addSynchronizationExit

public SynchronizationRecord.Exit addSynchronizationExit()
Description copied from interface: SynchronizationRecord
Called by a TraceRecorder when adding exit for this activity to target's biography. Initializes, adds, and returns a synchronization exit record for target's biography (exit must be last child in thread).
Specified by:
addSynchronizationExit in interface SynchronizationRecord
Tags copied from interface: SynchronizationRecord
Throws:
IllegalStateException - if not SynchronizationRecord.isSynchronized() or SynchronizationRecord.isSynchronizedWait(), or if this already has an exit.
See Also:
SynchronizationRecord.getSynchronizationExit()

makeSynchronizationEntryRecord

protected SynchronizationRecord.Entry makeSynchronizationEntryRecord()
overridable method; returns new SynchronizationRecordDefault.Entry

makeSynchronizationExitRecord

protected SynchronizationRecord.Exit makeSynchronizationExitRecord()
overridable method; returns new SynchronizationRecordDefault.Exit

finished

public void finished()
Trims child list (or sets to null if empty).
Overrides:
finished in class ActivityRecordBase

getSynchronizationChildren

public List getSynchronizationChildren()
synchronization children are SynchronizationRecords for recursive (possibly indirect) synchronizing or waiting
Specified by:
getSynchronizationChildren in interface SynchronizationRecord
Tags copied from interface: SynchronizationRecord
Returns:
list of SynchronizationRecords of recursive synchronization activities during this activity (e.g., recursive java synchronization by a thread).

addSynchronizationChild

public void addSynchronizationChild(SynchronizationRecord child)
Description copied from interface: SynchronizationRecord
add record of nested/recursive call for synchronization e.g., a nested synchronized block or wait. Calls childRecord.SynchronizationRecord.setSynchronizationParent(edu.mit.ai.psg.traveler.SynchronizationRecord)(this)
Specified by:
addSynchronizationChild in interface SynchronizationRecord

getSynchronizationParent

public SynchronizationRecord getSynchronizationParent()
Specified by:
getSynchronizationParent in interface SynchronizationRecord
Tags copied from interface: SynchronizationRecord
Returns:
record of enclosing recorded synchronization activity, or null if none. SynchronizationParent may be indirect caller if intermediate activities are not recorded.

setSynchronizationParent

public void setSynchronizationParent(SynchronizationRecord syncParent)
Description copied from interface: SynchronizationRecord
called by SynchronizationRecord.addSynchronizationChild(edu.mit.ai.psg.traveler.SynchronizationRecord)
Specified by:
setSynchronizationParent in interface SynchronizationRecord

toString

public String toString()
returns "(synchronized(target) in member)"
Overrides:
toString in class ActivityRecordBase

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu