Application servers use several concepts to make multithreading easy for the average programmer.
The most important concept is thead confinement. To understand the concept, read the answers to this question.
In your situation, there is more than one thread involved, but there is also some API that enables you to handle data from one thread to the other in a safe way. Most of the time there are thread pools envolved, see Introduction to Thread Pools in Java.
In JMS there are some objects that are not allowed to be used in different threads (e.g. the Session object), some are (e.g. the Connection, the JmsTemplate). Read the answers to "Why JMS Session Object is not thread safe?". The consequences are listed here.
I recommend reading the Spring documentation on this topic.