NonStop JMS User's Manual (H06.03+, J06.03+, NonStop JMS 3.0+)
NSJMS and JMS Client Applications
NonStop Server for Java Message Service User’s Manual—522356-006
4-16
Threading
Threading
You can use JMS with multithreaded Java applications. Although threading is 
supported, the send calls block the process during send operations and the receive 
calls support the non-blocking features of SQL/MX during receive operations when 
sqlmx_nowait is set to on.
Two NSJMS property values specify the threading behavior. The Database.Timeout 
property value is the time in milliseconds during which stream selects block for new 
messages before a timeout. The Database.Delay property value is the time in 
milliseconds that the thread is delayed after a timeout.
Setting the Database.Timeout and Database.Delay values below 1000 gives 
more responsive threads because the read is stopped and restarted frequently, which 
allows other threads to run. This responsiveness costs in system throughput, however, 
because the read is tried several times for each message. In single-threaded 
applications and applications where inter-thread responsiveness is not critical, use 
Database.Timeout and Database.Delay values greater than 1000 so that the 
JVM is not busy waiting. When messages are not available, the process blocks, 
allowing other processes to run.
Send Operations
Queue-send operations and Topic publish operations block the process for a short 
duration during a SQL INSERT operation. 
Receive Operations
Queue-receive operations and Topic-receive operations support the non-blocking 
features of SQL/MX during receive operations only when the system property 
sqlmx_nowait is set to on. The non-blocking features of SQL/MX are useful in multi-
threaded programs that use separate threads to receive messages simultaneously 
from different sources or to perform processing while awaiting messages.
The system property sqlmx_nowait toggles the non-blocking function. The default 
value is off. sqlmx_nowait can be set from the command line by using the -D option 
(-Dsqlmx_nowait=on|off) or programmatically, before obtaining the first NSJMS 
connection, by using the System.setProperty() method.
The sqlmx_nowait value is obtained from the environment only at the time of the first 
JDBC/MX connection. The JDBC/MX driver is then configured with the value of the 
sqlmx_nowait system property for any subsequent connections within the same 
JVM. 
After initiating the receive operation, NSJMS yields the thread control to the JVM. 
When a message arrives, the JVM wakes up the thread and returns the message to 
the application.
If sqlmx_nowait is set to on, users may want to set the Database.timeout value 
to 1000+ milliseconds so the thread waits on messages for a longer period. The larger 










