org.sourceforge.jemm.client.events
Class EntitiesContext

java.lang.Object
  extended by org.sourceforge.jemm.client.events.EntitiesContext
All Implemented Interfaces:
StackTracer

public class EntitiesContext
extends java.lang.Object
implements StackTracer

Tracks all stack information for JEMMObjects. This class is thread safe. All listener events however are executed outside of any lock and can happen in parallel.

Author:
Paul Keeble

Constructor Summary
EntitiesContext(LockTracer lockTracer, MethodContextListener listener)
          Creates an Event Generator with all context aware events going to the passed listener.
 
Method Summary
 void enterMethod(java.lang.Object entity, Descriptor method)
          Marks an method entered and tracks appropriately the current thread as entering the method on the entity.
 void exitMethod(java.lang.Object entity, Descriptor method)
          Exits a method, removing any contexts that have been created.
 boolean isEntityEntered(java.lang.Object entity)
          Determines if any thread has entered the entity.
 boolean isMethodEntered(java.lang.Object entity, Descriptor method)
          Determines if the current thread is currently in the entity and method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntitiesContext

public EntitiesContext(LockTracer lockTracer,
                       MethodContextListener listener)
Creates an Event Generator with all context aware events going to the passed listener.

Parameters:
listener -
Method Detail

enterMethod

public void enterMethod(java.lang.Object entity,
                        Descriptor method)
Marks an method entered and tracks appropriately the current thread as entering the method on the entity. Calls listener.methodEntered, and if this is the first thread into the Object calls entityEntered first.

Specified by:
enterMethod in interface StackTracer
Parameters:
entity - The object entered
method - The method by which it was entered

isMethodEntered

public boolean isMethodEntered(java.lang.Object entity,
                               Descriptor method)
Determines if the current thread is currently in the entity and method.

Specified by:
isMethodEntered in interface StackTracer
Parameters:
entity - The object
method - The method on the object
Returns:
true if the thread has previously be entered, false otherwise

isEntityEntered

public boolean isEntityEntered(java.lang.Object entity)
Determines if any thread has entered the entity.

Specified by:
isEntityEntered in interface StackTracer
Parameters:
entity - The object to check
Returns:
True if the entity has been entered, false otherwise

exitMethod

public void exitMethod(java.lang.Object entity,
                       Descriptor method)
Exits a method, removing any contexts that have been created. Calls the listener.methodExit and if this is the last exit of all threads also calls entityExited

Specified by:
exitMethod in interface StackTracer
Parameters:
entity - The object being exited
method - The method from which the thread is exiting


Copyright © 2009. All Rights Reserved.