|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SocketProcessingStrategy
A socket processing strategy implements a strategy to be used by a
ProgramEventDispatcher
to receive probes received from a subject
communicating using a socket connection and dispatch them as events.
Method Summary | |
---|---|
void |
dispatcherStarting()
Message sent by the event dispatcher to indicate that it is about to start receiving data to publish its event stream. |
void |
dispatcherStopped()
Message sent by the event dispatcher to indicate that it has stopped receiving data used to publish its event stream. |
void |
doHandshake(java.net.Socket sbjSocket)
Executes the handshake procedure with the socket probe. |
void |
processProbes(java.net.Socket sbjSocket,
ControlData cntrl)
The standard trace processing loop, used for all subjects except other event dispatchers. |
void |
processProbesSynchronized(java.net.Socket sbjSocket,
ControlData cntrl)
The synchronized trace processing loop. |
Methods inherited from interface sofya.ed.structural.ActiveComponent |
---|
configure, isReady, register, release, reset |
Method Detail |
---|
void dispatcherStarting()
This message provides the processing strategy an opportunity to take some action prior to handling the event stream, such as issuing a message to listeners.
void dispatcherStopped()
This message provides the processing strategy an opportunity to take some action after handling the event stream, such as issuing a message to listeners.
void doHandshake(java.net.Socket sbjSocket) throws AbstractEventDispatcher.ExecException, java.io.IOException
This method should check whether the type of instrumentation indicated by the socket probe is appropriate for this processing strategy. If it is not, an error response should be sent to the socket probe and an exception thrown. Otherwise, the integer code for the form of instrumentation to be processed should be returned.
sbjSocket
- Main communications socket which is connected to the
socket probe.
AbstractEventDispatcher.ExecException
- If the instrumentation in the subject is not
appropriate for this type of filter.
java.io.IOException
- If there is any error communicating through
the socket.void processProbes(java.net.Socket sbjSocket, ControlData cntrl)
The run loop waits for the subject to negotiate a socket connection
and then begins processing trace messages until the socket stream is
closed. If the subject is not instrumented, this loop will be killed
while waiting for the subject to connect when the main thread calls
ProgramEventDispatcher.stopServer()
.
A standard trace processing loop is provided distinct from the
synchronized version so that the cost of synchronization is not
incurred for all subjects. This also avoids complications related to
determining when to strip timestamps from trace messages. The cost of
this implementation is that you must remember to update both this
method and processProbesSynchronized(java.net.Socket, sofya.ed.structural.ControlData)
when
making changes to how trace messages are processed.
void processProbesSynchronized(java.net.Socket sbjSocket, ControlData cntrl)
The processing performed by this run loop should be functionally
equivalent to that of processProbes(java.net.Socket, sofya.ed.structural.ControlData)
. The only
difference is that this loop should synchronize access to the
listeners.
Note: This method is only expected to synchronize two threads. The event dispatcher will never execute this method from more than two threads, as there is no reason to do so.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |