Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
4.96 Mб

Developing and Installing Applications That Use the XA Libraries

Table 16–3 (Cont.) TPM Replacement Commands

Regular Oracle Database Commands

TPM Functions




Not allowed



XA Library Thread Safety

If you use a transaction monitor that supports threads, then the Oracle XA library lets you write applications that are thread safe. Certain issues must be kept in mind, however.

A thread of control (or thread) refers to the set of connections to resource managers. In an nonthreaded system, each process could be considered a thread of control, because each process has its own set of connections to resource managers and each process maintains its own independent resource manager table.

In a threaded system, each thread has an autonomous set of connections to resource managers and each thread maintains a private resource manager table. This private resource manager table must be allocated for each new thread and de-allocated when the thread terminates, even if the termination is abnormal.

Note: In Oracle Database, once a thread has been started and establishes a connection, only that thread can use that connection. No other thread can make a call on that connection.

Specifying Threading in the Open String

The xa_open string parameter, xa_info, provides the clause, Threads=, which must be specified as true to enable the use of threads by the transaction monitor. The default is false. Note that, in most cases, threads are created by the transaction monitor, and the application does not know when a new thread is created. Therefore, it is advisable to allocate a service context (lda in Version 7) on the stack within each service that is written for a transaction monitor application. Before doing any Oracle Database-related calls in that service, the xaoSvcCtx (sqlld2 for Version 7 OCI) function must be called and the service context initialized. This LDA can then be used for all OCI calls within that service.

Restrictions on Threading in XA

The following restrictions apply when using threads:

Any Pro* or OCI code that executes as part of the application server process on the transaction monitor cannot be threaded unless the transaction monitor is

Using Oracle XA with Transaction Monitors 16-23

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Мы не исправляем ошибки в тексте (почему?), но будем благодарны, если вы все же напишите об ошибках.

Соседние файлы в папке Oracle 10g