CORBA 2.3.3 Programmer's Guide for Java
spawns a new thread (if the thread pool is empty and the maximum number of threads has not been
reached) to handle the new request. For a new or reused thread to be activated, the thread processing the
original request must have become blocked or have explicitly released control of the processor. If the
thread does not release control of the processor, the POA thread cannot run and spawn or reuse a thread.
By using the ORB_CTRL_MODEL threading policy, servers can take advantage of multithreading
without doing any explicit programming. In certain situations, however, you might also find it desirable
to make a server explicitly spawn new threads. Such threads can coexist with POA-spawned threads.
When doing explicit multithreading in server programs, keep the following points in mind:
Do not make process-blocking calls from a thread. Such calls defeat the purpose of a multithreaded
process because the whole process is blocked for the duration of the call. The SQL/MP and
SQL/MX products do not support threads; therefore, all SQL calls are process-blocking calls.
●
Operations directed to distributed objects are thread-blocking; nowait file I/O operations are also
thread-blocking. Such operations block only the calling thread, rather than the whole process. A
well-designed multithreaded program makes use of thread-blocking operations but not
process-blocking operations.
●
Multiple active requests for the same object can be dispatched within multiple threads at the same
time. Therefore, you must code such portions as thread-safe (reentrant) code, protecting the
object from access by more than one thread at a time.
●
Prev Up Next
Chapter 7. Managing Transactions
Home
Chapter 9. Designing Advanced
Applications