This section provides information about more advanced development techniques supported by the Handler.
To get understanding in which state the Handler currently is, it's necessary to implement the OnixS::Mts::BondVision::SDP::HandlerStateListener class interface and associate an instance with the Handler using OnixS::Mts::BondVision::SDP::Handler::registerHandlerStateListener member.
The table below describes all possible states for the Handler:
State | Description |
OnixS::Mts::BondVision::SDP::HandlerState::Disconnected | Handler is disconnected or was not executed yet. |
OnixS::Mts::BondVision::SDP::HandlerState::Disconnecting | The intermediate state when the Handler is not disconnected but not connected. |
OnixS::Mts::BondVision::SDP::HandlerState::Connected | Handler is connected. |
OnixS::Mts::BondVision::SDP::HandlerState::Connecting | The intermediate state when the Handler is not connected but not disconnected. |
The Handler logs an important aspects of its execution into the directory specified by the OnixS::Mts::BondVision::SDP::HandlerSettings::logDirectory member value. Logging includes network data received and processed by the Handler and, of course, errors occurred at execution time.
Since the Handler outputs logging data into regular files, this affects its performance and sometimes requires significant system resources like space on hard drive. The Handler exposes several parameters which allow to suppress certain kind of logging data and thus reduce load to the file system as well as to increase general performance.
Following table describes logging-related parameters exposed by the OnixS::Mts::BondVision::SDP::HandlerSettings structure:
Settings Member | Default value | Description |
logLevel | OnixS::Mts::BondVision::SDP::LogLevel::Info | Specifies whether the Handler must output informational messages about its state as well as which kind of information must be put into the log. For more information, please, take a look at the description of OnixS::Mts::BondVision::SDP::LogLevel enumeration entries. |
logSettings | OnixS::Mts::BondVision::SDP::LogSettings::Default | If logging is activated, this member specifies which additional data must be put into the log. For more information, please, take a look at the description of OnixS::Mts::BondVision::SDP::LogSettings enumeration entries. |
Following example demonstrates how to enable logging in the Handler:
The Handler provides an asynchronous logging facility. Asynchronous logging is the way to go to minimize file I/O latencies. Following example demonstrates how to enable asynchronous logging in the Handler:
The Handler starts with two threads: one for sending messages and another for receiving messages.
One additional thread will be created if asynchronous logging facility is used. For more details please see Asynchronous logging section.
All callbacks of the following message listeners:
are fired from one thread.
It is very important for user code to be as fast as possible in these callbacks to avoid delay with next message processing.
Please use this code snippet to disable all logging operations:
Please use this code snippet to set processor affinity mask for sending and receiving threads.