Class SocketAnalyzer

java.lang.Object
org.simpleframework.transport.connect.SocketAnalyzer
All Implemented Interfaces:
TraceAnalyzer

class SocketAnalyzer extends Object implements TraceAnalyzer
The SocketAnalyzer 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. All Trace objects returned from this will catch all exceptions within the created trace.
  • Field Details

    • analyzer

      private final TraceAnalyzer analyzer
      This is the analyzer that is used to create the trace objects.
  • Constructor Details

    • SocketAnalyzer

      public SocketAnalyzer(TraceAnalyzer analyzer)
      Constructor for the SocketAnalyzer 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 Details

    • attach

      public Trace attach(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 interface TraceAnalyzer
      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 interface TraceAnalyzer