sofya.apps.atomicity
Class AutomataController

java.lang.Object
  extended by sofya.ed.semantic.EventFilter
      extended by sofya.ed.semantic.EventSelectionFilter
          extended by sofya.apps.atomicity.AutomataController
All Implemented Interfaces:
ChainedEventListener, EventListener

public class AutomataController
extends EventSelectionFilter
implements ChainedEventListener

Starts and stops the automata which check whether a method is atomic on a particular invocation. Each automata controller should be associated with a single thread.

Version:
12/12/2005
Author:
Alex Kinneer

Nested Class Summary
 
Nested classes/interfaces inherited from interface sofya.ed.semantic.EventListener
EventListener.Arguments, EventListener.CallData, EventListener.ExceptionData, EventListener.FieldData, EventListener.MethodData, EventListener.MonitorData, EventListener.NewAllocationData, EventListener.ObjectData, EventListener.ThreadData, EventListener.ThreadStatus
 
Field Summary
 
Fields inherited from class sofya.ed.semantic.EventFilter
listenerCount, listeners
 
Constructor Summary
AutomataController(EventClassifier classifier, ResultCollector results)
          Creates a new automata controller.
 
Method Summary
 void constructorEnterEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MethodData md)
          Notification that a constructor was entered.
 void constructorExitEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MethodData md)
          Notification that a constructor was exited.
static ChainedEventListenerFactory getFactory(EventClassifier classifier, ResultCollector results)
          Gets a factory for producing instances of this class attached to a filter stream.
 ChainedEventListener getParent()
          Gets the parent of this listener in the listener chain.
 long getStreamID()
          Gets the unique identifier associated with this event stream.
 java.lang.String getStreamName()
          Gets an informational name associated with this event stream.
 void instanceFieldAccessEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.FieldData fd)
          Notification that an instance field was read.
 void instanceFieldWriteEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.FieldData fd)
          Notification that an instance field was written.
 void monitorAcquireEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MonitorData md)
          Notification that a thread has acquired a monitor.
 void monitorContendEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MonitorData md)
          Notification that a thread is contending for a monitor.
 void monitorPreReleaseEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MonitorData md)
          Notification that a thread is about to release a monitor.
 void monitorReleaseEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MonitorData md)
          Notification that a thread has released a monitor.
protected  void startAutomata(MethodSignature mSig)
           
 void staticFieldAccessEvent(EventListener.ThreadData td, EventListener.FieldData fd)
          Notification that a static field was read.
 void staticFieldWriteEvent(EventListener.ThreadData td, EventListener.FieldData fd)
          Notification that a static field was written.
 void staticMethodEnterEvent(EventListener.ThreadData td, EventListener.MethodData md)
          Notification that a static method was entered.
 void staticMethodExitEvent(EventListener.ThreadData td, EventListener.MethodData md)
          Notification that a static method was exited.
protected  void stopAutomata(MethodSignature mSig)
           
 void virtualMethodEnterEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MethodData md)
          Notification that a virtual method was entered.
 void virtualMethodExitEvent(EventListener.ThreadData td, EventListener.ObjectData od, EventListener.MethodData md)
          Notification that a virtual method was exited.
 
Methods inherited from class sofya.ed.semantic.EventSelectionFilter
callReturnEvent, classPrepareEvent, constructorCallEvent, exceptionCatchEvent, exceptionThrowEvent, executionStarted, interfaceCallEvent, newAllocationEvent, staticCallEvent, staticInitializerEnterEvent, systemExited, systemStarted, threadDeathEvent, threadStartEvent, virtualCallEvent
 
Methods inherited from class sofya.ed.semantic.EventFilter
addEventListener, ensureCapacity, removeEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sofya.ed.semantic.EventListener
callReturnEvent, classPrepareEvent, constructorCallEvent, exceptionCatchEvent, exceptionThrowEvent, executionStarted, interfaceCallEvent, newAllocationEvent, staticCallEvent, staticInitializerEnterEvent, systemExited, systemStarted, threadDeathEvent, threadStartEvent, virtualCallEvent
 

Constructor Detail

AutomataController

public AutomataController(EventClassifier classifier,
                          ResultCollector results)
Creates a new automata controller.

Parameters:
classifier - Global classifier to which automata created by this controller can delegate classification if desired.
results - Result collector used to record results of atomicity checking on invoked methods.
Method Detail

getFactory

public static ChainedEventListenerFactory getFactory(EventClassifier classifier,
                                                     ResultCollector results)
Gets a factory for producing instances of this class attached to a filter stream.

Parameters:
classifier - Global classifier to which automata created by the generated controllers can delegate classification if desired.
results - Result collector used by the generated controllers to record results of atomicity checking on invoked methods.
Returns:
A factory which produces automata controllers attached to the current event stream.

getParent

public ChainedEventListener getParent()
Description copied from interface: ChainedEventListener
Gets the parent of this listener in the listener chain.

Specified by:
getParent in interface ChainedEventListener
Returns:
The event listener from which this listener receives events.

getStreamID

public long getStreamID()
Description copied from interface: ChainedEventListener
Gets the unique identifier associated with this event stream.

Specified by:
getStreamID in interface ChainedEventListener
Returns:
An value which should uniquely identify this event stream, typically derived from some characteristic of the filtering criteria being applied by the parent listener.

getStreamName

public java.lang.String getStreamName()
Description copied from interface: ChainedEventListener
Gets an informational name associated with this event stream.

Specified by:
getStreamName in interface ChainedEventListener
Returns:
A string which provides some description of the nature of the events handled by this string.

startAutomata

protected void startAutomata(MethodSignature mSig)

stopAutomata

protected void stopAutomata(MethodSignature mSig)

monitorContendEvent

public void monitorContendEvent(EventListener.ThreadData td,
                                EventListener.ObjectData od,
                                EventListener.MonitorData md)
Description copied from interface: EventListener
Notification that a thread is contending for a monitor.

Specified by:
monitorContendEvent in interface EventListener
Overrides:
monitorContendEvent in class EventSelectionFilter
Parameters:
td - Information about the thread which is contending for a monitor.
od - Information about the object which owns the monitor.
md - Information about the location of the monitor contention.

monitorAcquireEvent

public void monitorAcquireEvent(EventListener.ThreadData td,
                                EventListener.ObjectData od,
                                EventListener.MonitorData md)
Description copied from interface: EventListener
Notification that a thread has acquired a monitor.

Specified by:
monitorAcquireEvent in interface EventListener
Overrides:
monitorAcquireEvent in class EventSelectionFilter
Parameters:
td - Information about the thread which acquired a monitor.
od - Information about the object which owns the monitor.
md - Information about the location of the monitor acquisition.

monitorPreReleaseEvent

public void monitorPreReleaseEvent(EventListener.ThreadData td,
                                   EventListener.ObjectData od,
                                   EventListener.MonitorData md)
Description copied from interface: EventListener
Notification that a thread is about to release a monitor.

Specified by:
monitorPreReleaseEvent in interface EventListener
Overrides:
monitorPreReleaseEvent in class EventSelectionFilter
Parameters:
td - Information about the thread which is about to release a monitor.
od - Information about the object which owns the monitor.
md - Information about the location of the monitor about to be released event..

monitorReleaseEvent

public void monitorReleaseEvent(EventListener.ThreadData td,
                                EventListener.ObjectData od,
                                EventListener.MonitorData md)
Description copied from interface: EventListener
Notification that a thread has released a monitor.

Specified by:
monitorReleaseEvent in interface EventListener
Overrides:
monitorReleaseEvent in class EventSelectionFilter
Parameters:
td - Information about the thread which released a monitor.
od - Information about the object which owns the monitor.
md - Information about the location of the monitor release.

staticFieldAccessEvent

public void staticFieldAccessEvent(EventListener.ThreadData td,
                                   EventListener.FieldData fd)
Description copied from interface: EventListener
Notification that a static field was read.

Specified by:
staticFieldAccessEvent in interface EventListener
Overrides:
staticFieldAccessEvent in class EventSelectionFilter
Parameters:
td - Information about the thread in which the field access occurred.
fd - Information about the accessed field.

instanceFieldAccessEvent

public void instanceFieldAccessEvent(EventListener.ThreadData td,
                                     EventListener.ObjectData od,
                                     EventListener.FieldData fd)
Description copied from interface: EventListener
Notification that an instance field was read.

Specified by:
instanceFieldAccessEvent in interface EventListener
Overrides:
instanceFieldAccessEvent in class EventSelectionFilter
Parameters:
td - Information about the thread in which the field access occurred.
od - Information about the object which owns the accessed field.
fd - Information about the accessed field.

staticFieldWriteEvent

public void staticFieldWriteEvent(EventListener.ThreadData td,
                                  EventListener.FieldData fd)
Description copied from interface: EventListener
Notification that a static field was written.

Specified by:
staticFieldWriteEvent in interface EventListener
Overrides:
staticFieldWriteEvent in class EventSelectionFilter
Parameters:
td - Information about the thread in which the field write occurred.
fd - Information about the written field.

instanceFieldWriteEvent

public void instanceFieldWriteEvent(EventListener.ThreadData td,
                                    EventListener.ObjectData od,
                                    EventListener.FieldData fd)
Description copied from interface: EventListener
Notification that an instance field was written.

Specified by:
instanceFieldWriteEvent in interface EventListener
Overrides:
instanceFieldWriteEvent in class EventSelectionFilter
Parameters:
td - Information about the thread in which the field write occurred.
od - Information about the object which owns the written field.
fd - Information about the written field.

constructorEnterEvent

public void constructorEnterEvent(EventListener.ThreadData td,
                                  EventListener.ObjectData od,
                                  EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a constructor was entered.

This is the first point during the object creation process at which the object can be uniquely identified.

Specified by:
constructorEnterEvent in interface EventListener
Overrides:
constructorEnterEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the constructor.
od - Information about the object under construction. At the time of this event, only the object ID will be valid.
md - Information about the entered constructor.

constructorExitEvent

public void constructorExitEvent(EventListener.ThreadData td,
                                 EventListener.ObjectData od,
                                 EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a constructor was exited.

NOTE: This event is raised only if the constructor completes normally. If a constructor throws an escaping exception, the object is not successfully created and thus further events related to the object are not possible.

Specified by:
constructorExitEvent in interface EventListener
Overrides:
constructorExitEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the constructor.
od - Information about the object under construction. At the time of this event, only the object ID will be valid.
md - Information about the exited constructor.

virtualMethodEnterEvent

public void virtualMethodEnterEvent(EventListener.ThreadData td,
                                    EventListener.ObjectData od,
                                    EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a virtual method was entered.

Specified by:
virtualMethodEnterEvent in interface EventListener
Overrides:
virtualMethodEnterEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the method.
od - Information about the object on which the virtual method was called.
md - Information about the entered method.

virtualMethodExitEvent

public void virtualMethodExitEvent(EventListener.ThreadData td,
                                   EventListener.ObjectData od,
                                   EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a virtual method was exited.

Specified by:
virtualMethodExitEvent in interface EventListener
Overrides:
virtualMethodExitEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the method.
od - Information about the object on which the virtual method was called.
md - Information about the exited method.

staticMethodEnterEvent

public void staticMethodEnterEvent(EventListener.ThreadData td,
                                   EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a static method was entered.

Specified by:
staticMethodEnterEvent in interface EventListener
Overrides:
staticMethodEnterEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the method.
md - Information about the entered method.

staticMethodExitEvent

public void staticMethodExitEvent(EventListener.ThreadData td,
                                  EventListener.MethodData md)
Description copied from interface: EventListener
Notification that a static method was exited.

Specified by:
staticMethodExitEvent in interface EventListener
Overrides:
staticMethodExitEvent in class EventSelectionFilter
Parameters:
td - Information about the thread executing the method.
md - Information about the exited method.