Class SocketAnalyzer

  • All Implemented Interfaces:
    TraceAnalyzer

    class SocketAnalyzer
    extends java.lang.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 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 the SocketAnalyzer 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 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 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 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