About the Locking Service
The com.sabre.edge.cf.host.Locking service (sometimes informally referred to as the "locking service") locks and releases a TA session, thereby preventing other Red Apps from using the locked session. Sabre emulator and other types of applications cannot use this locked session. After a Red App unlocks the TA session, the session is available to other Red Apps and other types of applications. One Red App at a time can lock a specific TA session.
A Red App can use either the host communications or Sabre Web Services (SWS) communications services either separately or in conjunction with the locking service. When a Red App uses either of these services to send a single command in a single session, the service inquires whether a lock is set on the TA session. The result will be negative, consequently, the communications service locks the session and the emulator screen, sends a command, and then unlocks the session and screen during service processing.
When a Red App sends multiple commands in a single session using either of these services, the Red App tracks the locking mechanism by itself. The Red App uses the locking service and then sends a set of commands to the host or SWS communications service. The service verifies that the lock is already set on the session each time the Red App sends a command. The result will be positive, consequently, the service executes the command, and the Red App unlocks the TA session.
Locking Service Timeouts
The default lock time is 60 seconds, which is set after the service returns a response. If your code does not release the lock, the lock times out and it is released automatically after the default value elapses. You can set a timeout value for the locking service that is within the minimum and maximum range of values that is defined for the com.sabre.edge.cf.host.Locking service. If you set a timeout value that is outside the minimum and maximum range, a runtime exception is thrown. For the timeout values, consult the Javadocs in Sabre Red 360 Developer Toolkit.
Locks and multiple threads
In general, using multiple threads is discouraged while interacting with Sabre Host. Due to the nature of communication between Sabre Red 360 and Sabre Host it is not possible to properly match commands and responses sent through multiple threads at same time, especially when commands have multiple responses. Also, when multiple threads try to access Sabre Host, an error HOST000 might be returned. This error means that there was problem with communication with Sabre Host and there is no guarantee that command has been processed by the Sabre Host properly.