Class SocketAnalyzer
- java.lang.Object
-
- org.simpleframework.transport.connect.SocketAnalyzer
-
- All Implemented Interfaces:
TraceAnalyzer
class SocketAnalyzer extends java.lang.Object implements TraceAnalyzer
TheSocketAnalyzer
is used to wrap an analyzer object. Wrapping an analyzer in this way ensures that even if the analyzer is badly written there is little chance that it will affect the operation of the server. AllTrace
objects returned from this will catch all exceptions within the created trace.
-
-
Field Summary
Fields Modifier and Type Field Description private TraceAnalyzer
analyzer
This is the analyzer that is used to create the trace objects.
-
Constructor Summary
Constructors Constructor Description SocketAnalyzer(TraceAnalyzer analyzer)
Constructor for theSocketAnalyzer
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Trace
attach(java.nio.channels.SelectableChannel channel)
This method is used to attach a trace to the specified channel.void
stop()
This is used to stop the analyzer and clear all trace information.
-
-
-
Field Detail
-
analyzer
private final TraceAnalyzer analyzer
This is the analyzer that is used to create the trace objects.
-
-
Constructor Detail
-
SocketAnalyzer
public SocketAnalyzer(TraceAnalyzer analyzer)
Constructor for theSocketAnalyzer
object. This will be given the analyzer that is to be used to create traces. This can be a null value, in which case the trace provided will be a simple empty void that swallows all trace events.- Parameters:
analyzer
- the analyzer that is to be wrapped by this
-
-
Method Detail
-
attach
public Trace attach(java.nio.channels.SelectableChannel channel)
This method is used to attach a trace to the specified channel. Attaching a trace basically means associating events from that trace with the specified socket. It ensures that the events from a specific channel can be observed in isolation.- Specified by:
attach
in interfaceTraceAnalyzer
- Parameters:
channel
- this is the channel to associate with the trace- Returns:
- this returns a trace associated with the channel
-
stop
public void stop()
This is used to stop the analyzer and clear all trace information. Stopping the analyzer is typically done when the server is stopped and is used to free any resources associated with the analyzer. If an analyzer does not hold information this method can be ignored.- Specified by:
stop
in interfaceTraceAnalyzer
-
-