I could be wrong in my thread restriction assumtion.. I'm going to go dig into the spec again to see where I was I think I saw this..
But you ask how I would address garanteed message ordering... The basic problem you have is that you have to serialize access the the message producer. Thus you need to synchronize access to:
synchronize( mutex ) {
gen();// generate the order dependent message
pub();// publish the order dependent message
}
If you dont synchronize with something like this, then you might still produce out of order messages depending on how the threads are scheduled.
For instance, consider this sequence:
Thread A: calls gen();
Thread B: calls gen();
Thread B: calls pub();
Thread A: calss pub();
Thif gen() is numbering messages, the when received, the messages would be out of order.
Regards,
Hiram
> >No, the multiple thread trying to use one session is
> not open to interpretation. It's in bold print
> somewhere in the >spec :)
>
> I have re-read the spec again. To be honest, I can't
> even find anything that is in bold print that refers
> to sessions. Could you direct me to section and
> paragraph of the spec to which you are refering?
> Also, Section 4.4 states (in a footnote): "There are
> no restrictions on the number of threads that can use
> a Session object or those it creates."
>
Look at section 2.8 Multi-Threading.