JadeMultiWorkerTcpTransport Class
The JadeMultiWorkerTcpTransport class provides an interface for sharing the messages arriving on client connections associated with a single listen TCP/IP connection among a pool of server JADE applications. This enables server-style applications to share a workload generated by a large number of clients among a number of worker processes. No master or manager application is required.
You cannot create persistent or shared transient instances of this class or its subclasses.
All JADE worker processes must reside in the same JADE node as the TCP/IP listen connection.
The following terms are used in a JADE multiple worker TCP/IP connection environment.
-
The transport group encompasses the client connection pool, the worker pool, the listen connection, and so on.
-
The connection pool encompasses the group of client connections associated with the transport group.
-
The worker pool encompasses the group of JADE processes that are linked to the transport group.
Each transport group has a unique full name, which is a string containing the listenHostname property value, a colon (:) character, and the listenPortnumber property value. The listen connection uses the listenHostname and listenPortnumber property values for binding its local address and local port number, respectively. A JADE process joins a transport group by creating an instance of the JadeMultiWorkerTcpTransport class, setting the appropriate properties (at a minimum, the listenPortnumber property), and then calling the beginListening method.
If a JADE process attempts to join an unknown transport group, the requested transport group is created and that process joins it as the first worker. During creation, the group automatically creates the listen connection and opens it.
Any JADE process in a node can join an existing transport group, provided that it resides in the same JADE node and it knows the full name of the group (that is, the values of the listenHostname and listenPortnumber properties) and it uses exactly the same JadeMultiWorkerTcpTransport subclass.
When a process attempts to join a transport group, the validateServerProcess method is invoked. To perform additional basic security checks and reject the join attempt if necessary, reimplement this method on a JadeMultiWorkerTcpTransport subclass.
A worker leaves a transport group by deleting its instance of JadeMultiWorkerTcpTransport that it used to join the transport group. When the last worker leaves the transport group, the listen connection and any client connections are closed and the group is then deleted.
New workers are added to the end of the idle worker list and are the last to be woken.
For details about:
-
Connection assignment, connection binding, event handling, and reading and writing data, see "Connection Assignment", "Connection Binding", "JADE MultiWorker Events", and "Reading and Writing Data", respectively, in the following subsections
-
The class constants, properties, and methods defined in the JadeMultiWorkerTcpTransport class, see "JadeMultiWorkerTcpTransport Class Constants", "JadeMultiWorkerTcpTransport Properties", and "JadeMultiWorkerTcpTransport Methods", later in this chapter.
(None)