Establishing an outgoing connection

When a client connection is established to OpenSwitch, a thread is spawned to manage this connection. The thread performs these tasks:

  1. Based on the user name, application name, and host name of the incoming client connection, the thread determines which pool to use. The pool must have a state of either UP or LOCKED. If the pool state is UP, the thread proceeds to step 2. If the pool state is LOCKED, the thread sleeps until the state changes to either UP or DOWN, unless NOWAIT_ON_LOCKED is set to “1” in the OpenSwitch configuration file, in which case the thread returns to the client with a descriptive message, and no connection is established with the data server. See “Defining pools”.

  2. The thread requests the name of the next available server from the pool. The choice of server is based on the mode of the pool—CHAINED or BALANCED, as well as the state of the server—UP, DOWN, or LOCKED. A server is considered available only if its state is UP or LOCKED. If it is UP, the thread proceeds to step 3. If it is LOCKED, the thread sleeps until the server state changes to either UP or DOWN, unless NOWAIT_ON_LOCKED is set to 1 in the configuration file, in which case this thread returns to the client with a descriptive message and no connection is established with the data server.

  3. Using the user name and password of the incoming connection, an outgoing connection is established to the data server, and then bound to the incoming connection.

The following sections outline how the managing thread responds to various failure conditions during this process.