|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.ed.structural.processors.AbstractProcessingStrategy sofya.ed.structural.processors.AbstractSocketProcessingStrategy
public abstract class AbstractSocketProcessingStrategy
Base class for strategies to receive and process probes for a program event dispatcher.
Field Summary | |
---|---|
protected static boolean |
isSbjDispatcher
Local copy of the flag indicating whether the subject is itself an event dispatcher. |
protected static boolean |
PREEMPTIVE
Conditional compilation flag indicating whether the JVM is a preemptive JVM. |
protected static java.lang.Object |
traceLock
Lock used to synchronize access to the listener or listeners. |
Fields inherited from class sofya.ed.structural.processors.AbstractProcessingStrategy |
---|
instMode, sbjout, stderr, stdout |
Constructor Summary | |
---|---|
protected |
AbstractSocketProcessingStrategy()
|
Method Summary | |
---|---|
java.util.List |
configure(java.util.List parameters)
Configures this component from command line parameters. |
protected java.net.Socket |
openSignalSocket(java.net.Socket msgSocket)
Connects the signal socket used to allow basic communication with the subject's SocketProbe. |
protected java.lang.String |
parseMethodSignature(java.io.DataInputStream in,
byte[] buffer)
Reads the method signature portion of a trace message from the socket and parses it into its class name and fully qualified method name. |
void |
register(EventDispatcherConfiguration edConfig)
Registers this component with the event dispatcher. |
void |
release()
Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources. |
void |
reset()
Notifies this component to clear its configuration and reset any internal state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sofya.ed.structural.SocketProcessingStrategy |
---|
dispatcherStarting, dispatcherStopped, doHandshake, processProbes, processProbesSynchronized |
Methods inherited from interface sofya.ed.structural.ActiveComponent |
---|
isReady |
Field Detail |
---|
protected static boolean isSbjDispatcher
protected static java.lang.Object traceLock
protected static final boolean PREEMPTIVE
Constructor Detail |
---|
protected AbstractSocketProcessingStrategy()
Method Detail |
---|
public void register(EventDispatcherConfiguration edConfig)
AbstractProcessingStrategy
Registers this component with the event dispatcher.
register
in interface ActiveComponent
register
in class AbstractProcessingStrategy
edConfig
- The current configuration of system global resources
and settings that the component will use as appropriate.public java.util.List configure(java.util.List parameters)
ActiveComponent
Configures this component from command line parameters.
This method provides a component the opportunity to define and process command line parameters required to configure itself. Components participate in a processing chain, initiated in Sofya-provided event dispatchers by calling this method on the processing strategy. The processing strategies provided by Sofya in turn invoke this method on any listeners implementing this interface.
configure
in interface ActiveComponent
parameters
- A list of command line tokens that have not yet
been processed by any previous components.
public void reset()
ActiveComponent
Notifies this component to clear its configuration and reset any internal state.
Calls to this method are chained similary to the ActiveComponent.configure(java.util.List)
method. This method is invoked by the event dispatcher prior to
reconfiguration. Normally it should be used to clear any configuration
state to avoid using stale values.
reset
in interface ActiveComponent
public void release()
ActiveComponent
Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources.
Calls to this method are chained similary to the ActiveComponent.configure(java.util.List)
method. This method is invoked directly by a client of the event
dispatcher. Normally, it should be used to release any resources that
were required to persist over multiple runs of the event dispatcher.
release
in interface ActiveComponent
protected java.lang.String parseMethodSignature(java.io.DataInputStream in, byte[] buffer) throws java.io.IOException, AbstractEventDispatcher.ExecException
All of the outputs of this method are side effects.
in
- Input stream which is connected to the trace message socket.buffer
- Byte buffer used to hold the signature string when it
is read from the socket and from which the parsing is performed. If
the signature string exceeds the size of this buffer, the method will
still succeed, but will be considerably slower since it must process
the signature in chunks. A reasonably large buffer is recommended.
AbstractEventDispatcher.ExecException
- If the signature string is improperly encoded
and cannot be parsed.
java.io.IOException
- If there is any other error reading from the
socket.protected java.net.Socket openSignalSocket(java.net.Socket msgSocket) throws java.io.IOException
This method attempts to find a free port and bind a server socket to it. It then writes the chosen port onto the main socket connection for the SocketProbe to read and waits for the incoming connection. Once the connection is established, it returns the associated socket and no further data is written to the main socket connection.
Note: Coverage processing strategies do not use the signal socket, however we still negotiate the connection so the SocketProbe doesn't get confused. The signal socket is intended for use by sequence processing strategies.
msgSocket
- The main socket which will be used for trace messages,
which should be connected before calling this method.
java.io.IOException
- If an open port for the signal socket cannot be
found, there is an error connecting the socket, or there is an error
attempting to transmit the port number to the SocketProbe.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |