The handler supports the following threading models for usual sockets:
The OnixS::CME::iLink3::ThreadingModel::External mode supports the Solarflare TCPDirect technology that is described in the Solarflare TCPDirect section.
The model is configured via the OnixS::CME::iLink3::SessionSettings::threadingModel(ThreadingModel::Enum value) method.
In OnixS::CME::iLink3::ThreadingModel::Dedicated mode the Handler creates a dedicated receiving thread and a dedicated sending thread for each OnixS::CME::iLink3::Session instance.
The receiving thread receives and processes incoming SBE messages.
The Handler tries to send an outgoing application-level message in the thread that calls the OnixS::CME::iLink3::Session::send method. If the message cannot be sent immediately, then it is saved to the queue for the subsequent sending by the sending thread. This behavior can be changed using the OnixS::CME::iLink3::Session::messageGrouping method.
The following table shows which thread could fire a particular callback.
Callback | Application thread | Handler's Sending thread | Handler's receiving thread |
OnixS::CME::iLink3::SessionListener::onError | No | Yes | Yes |
OnixS::CME::iLink3::SessionListener::on*(All incoming strongly typed callbacks) | No | No | Yes |
OnixS::CME::iLink3::SessionListener::onReceivedBytes | No | No | Yes |
OnixS::CME::iLink3::SessionListener::onMessageSending | Yes | Yes | Yes |
OnixS::CME::iLink3::SessionListener::onStateChange | Yes | Yes | Yes |
OnixS::CME::iLink3::SessionListener::onWarning | Yes | Yes | Yes |
In OnixS::CME::iLink3::ThreadingModel::Pool mode the Handler creates the thread pool and shares it between all sessions.
The maximum number of threads in the pool is configured via the OnixS::CME::iLink3::SessionSettings::threadPoolSize parameter.
In OnixS::CME::iLink3::ThreadingModel::External mode the Handler does not create I/O threads. Such mode means that user creates additional threads himself (or uses the main thread), then performs event dispatching in a loop by calling the OnixS::CME::iLink3::SessionReactor::dispatchEvents() routine. This mode supports the Solarflare's TCPDirect and regular TCP connections. For TCPDirect connections, one should use the OnixS::CME::iLink3::TcpDirectStack as a reactor. For regular TCP connections, one should use OnixS::CME::iLink3::TcpStandardStack as a reactor.
Session
instance. This thread performs session storage operations.