[MWy] JMS sessions

Petr Tuma petr.tuma at dsrg.mff.cuni.cz
Fri Apr 18 07:57:21 CEST 2008


Dobry den,

> Chceme prece odlisit asynchronni a synchronni prijem zprav - tedy
> vytvorime si na jedne session 2 ruzne consumery.

Problem je v tom, ze funkce session se nesmi zavolat z vice nez jednoho 
vlakna. Kdyz si registrujete message listener, vlastne tim rikate, ze v 
ramci session bude aktivni nejaky systemovy thread, v ramci ktereho se 
budou ti message listeners volat. A protoze tento thread muze byt 
aktivni kdykoliv, neni mozne pouzit dalsi thread, kterym byste volal 
synchronni prijem zpravy. Standard o tom rika:

"One consequence of the session’s single-thread-of-control restriction 
is that a session with message listeners cannot also be used to 
synchronously receive messages. Either the session is dedicated to the 
thread of control used for delivery to message listeners, or it is 
dedicated to a thread of control initiated by client code. It is 
erroneous to attempt to combine both in the same session."

Petr Tuma







More information about the NSWI080 mailing list