Package org.jivesoftware.openfire.net
Class ServerSocketReader
- java.lang.Object
-
- org.jivesoftware.openfire.net.SocketReader
-
- org.jivesoftware.openfire.net.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 aThreadPoolExecutor
. 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
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.net.SocketReader
connection, directTLS, open, serverName, session
-
-
Constructor Summary
Constructors Constructor Description ServerSocketReader(PacketRouter router, RoutingTable routingTable, String serverName, Socket socket, SocketConnection connection, boolean useBlockingMode, boolean directTLS)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getExtraNamespaces()
protected void
processIQ(org.xmpp.packet.IQ packet)
Processes the packet in another thread if the packet has not been rejected.protected void
processMessage(org.xmpp.packet.Message packet)
Processes the packet in another thread if the packet has not been rejected.protected void
processPresence(org.xmpp.packet.Presence packet)
Processes the packet in another thread if the packet has not been rejected.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.protected void
shutdown()
Notification message indicating that the SocketReader is shutting down.-
Methods inherited from class org.jivesoftware.openfire.net.SocketReader
createSession, process, run
-
-
-
-
Constructor Detail
-
ServerSocketReader
public ServerSocketReader(PacketRouter router, RoutingTable routingTable, String serverName, Socket socket, SocketConnection connection, boolean useBlockingMode, boolean directTLS)
-
-
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 classSocketReader
- 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 classSocketReader
- 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 classSocketReader
- 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 classSocketReader
-
getExtraNamespaces
public String getExtraNamespaces()
- Overrides:
getExtraNamespaces
in classSocketReader
-
-