Interface Controller

  • All Known Implementing Classes:
    ContainerController

    interface Controller
    The Controller interface represents an object which is used to process collection events. The sequence of events that typically take place is for the collection to start, if not all of the bytes can be consumed it selects, and finally when all of the bytes within the entity have been consumed it is ready.

    The start event is used to immediately consume bytes form the underlying transport, it does not require a select to determine if the socket is read ready which provides an initial performance enhancement. Also when a response has been delivered the next request from the pipeline is consumed immediately.

    The select event is used to register the connected socket with a Java NIO selector which can efficiently determine when there are bytes ready to read from the socket. Finally, the ready event is used when a full HTTP entity has been collected from the underlying transport. On such an event the request and response can be handled by a container.

    See Also:
    Collector
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void ready​(Collector collector)
      The ready event is used when a full HTTP entity has been collected from the underlying transport.
      void select​(Collector collector)
      The select event is used to register the connected socket with a Java NIO selector which can efficiently determine when there are bytes ready to read from the socket.
      void start​(Collector collector)
      The start event is used to immediately consume bytes form the underlying transport, it does not require a select to check if the socket is read ready which improves performance.
      void start​(Channel channel)
      This is used to initiate the processing of the channel.
      void stop()
      This method is used to stop the Selector so that all resources are released.
    • Method Detail

      • start

        void start​(Channel channel)
            throws java.io.IOException
        This is used to initiate the processing of the channel. Once the channel is passed in to the initiator any bytes ready on the HTTP pipeline will be processed and parsed in to a HTTP request. When the request has been built a callback is made to the Container to process the request. Also when the request is completed the channel is passed back in to the initiator so that the next request can be dealt with.
        Parameters:
        channel - the channel to process the request from
        Throws:
        java.io.IOException
      • start

        void start​(Collector collector)
            throws java.io.IOException
        The start event is used to immediately consume bytes form the underlying transport, it does not require a select to check if the socket is read ready which improves performance. Also, when a response has been delivered the next request from the pipeline is consumed immediately.
        Parameters:
        collector - this is the collector used to collect data
        Throws:
        java.io.IOException
      • select

        void select​(Collector collector)
             throws java.io.IOException
        The select event is used to register the connected socket with a Java NIO selector which can efficiently determine when there are bytes ready to read from the socket.
        Parameters:
        collector - this is the collector used to collect data
        Throws:
        java.io.IOException
      • ready

        void ready​(Collector collector)
            throws java.io.IOException
        The ready event is used when a full HTTP entity has been collected from the underlying transport. On such an event the request and response can be handled by a container.
        Parameters:
        collector - this is the collector used to collect data
        Throws:
        java.io.IOException
      • stop

        void stop()
           throws java.io.IOException
        This method is used to stop the Selector so that all resources are released. As well as freeing occupied memory this will also stop all threads, which means that is can no longer be used to collect data from the pipelines.
        Throws:
        java.io.IOException