org.hopto.pentaj.jexin.client
Class TraceServer
java.lang.Object
org.hopto.pentaj.jexin.client.TraceServer
public class TraceServer
- extends java.lang.Object
TODO Get checked exceptions from method and allow any with 0 arg ctor to be injected (how to make this work when
I'm sending all the injectables up front?
TODO Keep map of methods by Method with signature, etc??
TODO Allow checked exceptions in injectable exceptions config but only allow them to be thrown from methods that declare them
Sends limited stack trace information to a client and allows the client to inject RuntimeException
s in real time
either before or after a method. This class is only intended to be used by the TraceAspect. It should be instantiated as a
Spring singleton and only in non-production environments.
Protocol details:
- A client connects (any currently connected client will be disconnected)
- The node name (String) is sent to the client
- A
Map
of ID (Integer) to description (String) is sent to the client for all injectable exceptions
- When the first monitored method is called a STACK_FRAME_START_ACTION is sent to the client
- The thread ID (long) is sent to the client
- The thread name (String) is sent to the client
- The method signature (String) is sent to the client
- The injectable exceptions for the method (int[]) is sent to the client
- The client responds with the PROCEED_ACTION or the ID of an error to be injected
- If the most recent stack frame is ending with a return and not throwing an exception, a STACK_FRAME_END_ACTION is sent to
the client followed by the thread ID (long)
- If the most recent stack frame is ending because an exception was thrown, a STACK_FRAME_EXCEPTION_ACTION is sent to the
client followed by the thread ID (long) then followed by the
Throwable
description (String) (this includes any
exception injected because of the client's response to the STACK_FRAME_START_ACTION)
- If a child stack frame is starting (the client received another STACK_FRAME_START_ACTION before the current frame ends),
go to step 3
If STACK_FRAME_END_ACTION or STACK_FRAME_EXCEPTION_ACTION occurs before the first STACK_FRAME_START_ACTION the client should
discard them.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
- See Also:
- Constant Field Values
TraceServer
public TraceServer()
TraceServer
public TraceServer(javax.net.ServerSocketFactory socketFactory)
setNodeName
public void setNodeName(java.lang.String nodeName)
setPort
public void setPort(int port)
setReadTimeout
public void setReadTimeout(int readTimeout)
setInjectableExceptions
public void setInjectableExceptions(java.util.Set<InjectableException> injectableExceptions)
init
public void init()
- Sets up the exception set and server thread and socket to accept new clients
destroy
public void destroy()
- Closes client and server sockets