Class ServerSocketReader

  • All Implemented Interfaces:
    Runnable

    public class ServerSocketReader
    extends SocketReader
    A SocketReader specialized for server connections. This reader will be used when the open stream contains a jabber:server namespace. Server-to-server communication requires two TCP connections between the servers where one is used for sending packets whilst the other connection is used for receiving packets. The connection used for receiving packets will use a ServerSocketReader since the other connection will not receive packets.

    The received packets will be routed using another thread to ensure that many received packets could be routed at the same time. To avoid creating new threads every time a packet is received each ServerSocketReader instance uses a ThreadPoolExecutor. By default the maximum number of threads that the executor may have is 50. However, this value may be modified by changing the property xmpp.server.processing.max.threads.

    Author:
    Gaston Dombiak
    • Method Detail

      • processIQ

        protected void processIQ​(org.xmpp.packet.IQ packet)
                          throws UnauthorizedException
        Processes the packet in another thread if the packet has not been rejected.
        Overrides:
        processIQ in class SocketReader
        Parameters:
        packet - the received packet.
        Throws:
        UnauthorizedException - if the connection required security but was not secured.
      • processPresence

        protected void processPresence​(org.xmpp.packet.Presence packet)
                                throws UnauthorizedException
        Processes the packet in another thread if the packet has not been rejected.
        Overrides:
        processPresence in class SocketReader
        Parameters:
        packet - the received packet.
        Throws:
        UnauthorizedException - if the connection required security but was not secured.
      • processMessage

        protected void processMessage​(org.xmpp.packet.Message packet)
                               throws UnauthorizedException
        Processes the packet in another thread if the packet has not been rejected.
        Overrides:
        processMessage in class SocketReader
        Parameters:
        packet - the received packet.
        Throws:
        UnauthorizedException - if the connection required security but was not secured.
      • processUnknowPacket

        protected boolean processUnknowPacket​(org.dom4j.Element doc)
        Remote servers may send subsequent db:result packets so we need to process them in order to validate new domains.
        Parameters:
        doc - the unknown DOM element that was received
        Returns:
        true if the packet is a db:result packet otherwise false.
      • shutdown

        protected void shutdown()
        Description copied from class: SocketReader
        Notification message indicating that the SocketReader is shutting down. The thread will stop reading and processing new requests. Subclasses may want to redefine this message for releasing any resource they might need.
        Overrides:
        shutdown in class SocketReader