org.hopto.pentaj.jexin.stacktrace
Class StackFrameProcessor

java.lang.Object
  extended by org.hopto.pentaj.jexin.stacktrace.StackFrameProcessor

public class StackFrameProcessor
extends java.lang.Object

Implementations process StackFrames to build a StackTrace. Each frame is analyzed to determine if the StackTrace to that point matches a StackTraceTemplate and what the response action should be. If the trace matches multiple templates to that frame and more than one result in an injected exception then one of the exceptions will be chosen arbitrarily.


Constructor Summary
StackFrameProcessor(java.util.List<StackTraceTemplate> matchingTemplates, java.util.List<InjectableException> injectableExceptions)
           
 
Method Summary
 void pop()
          Pops the open StackFrame on a normal return
 void pop(java.lang.String exception)
          Pops the open StackFrame when an exception is thrown
 InjectableException push(StackFrame stackFrame)
          Pushes the stackFrame onto the open StackTrace
 InjectableException startTrace(StackTraceManager manager, NodeAddress address, long threadId, java.lang.String threadName, StackFrame rootStackFrame)
          Sets the StackTrace that will be compared to the StackTraceTemplates.
 boolean tryCompleteTrace()
          If the stack trace is completed it is processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackFrameProcessor

public StackFrameProcessor(java.util.List<StackTraceTemplate> matchingTemplates,
                           java.util.List<InjectableException> injectableExceptions)
Method Detail

startTrace

public InjectableException startTrace(StackTraceManager manager,
                                      NodeAddress address,
                                      long threadId,
                                      java.lang.String threadName,
                                      StackFrame rootStackFrame)
Sets the StackTrace that will be compared to the StackTraceTemplates. This should only be called once, as the first method called after construction. None of the parameters may be null.

Parameters:
manager -
address -
threadId -
threadName -
rootStackFrame -
Returns:
True if the stack frame is completed, false if it isn't

push

public InjectableException push(StackFrame stackFrame)
Pushes the stackFrame onto the open StackTrace

Parameters:
stackFrame -
Returns:
The action to return to the server

pop

public void pop()
Pops the open StackFrame on a normal return


pop

public void pop(java.lang.String exception)
Pops the open StackFrame when an exception is thrown

Parameters:
exception -

tryCompleteTrace

public boolean tryCompleteTrace()
If the stack trace is completed it is processed. If it isn't no action is taken

Returns:
True if the stack trace is completed, false if it isn't