http://java.net/jira/browse/JMS_SPEC-52
This non-functional clarification was agreed some time ago.
I've now updated the javadocs and the draft spec to clarify this issue (these changes are additive, so those docs
include other changes).
The updated Javadocs are here:
http://java.net/projects/jms-spec/sources/repository/content/jms2.0/target/jms-2.0-javadoc.jar
The six message-creation methods on Session have been modified to include the following additional javadoc comments:
* The message object returned may be sent using any session or messaging context.
* It is not restricted to being sent using the session used to create it.
* <p>
* The message object returned may be optimised for use with the JMS provider
* used to create it. However it can be sent using any JMS provider, not just the
* JMS provider used to create it.
The second sentence above has been included because it would be confusing and inconsistent to mention that a message may
be sent using a different session and not also mention the even more significant fact that a message may be sent using a
different JMS provider.
The six message-creation methods on the proposed new MessagingContext interface have been modified to include the
following additional javadoc comments:
* The message object returned may be sent using any session or messaging context.
* It is not restricted to being sent using the messaging context used to create it.
* <p>
* The message object returned may be optimised for use with the JMS provider
* used to create it. However it can be sent using any JMS provider, not just the
* JMS provider used to create it.
The updated draft spec is here:
http://java.net/projects/jms-spec/sources/repository/content/jms2.0/specification/word/JMS20.pdf
All changes are highlighted clearly with changebars. The changes for this issue are as follows:
Section 4.4.5. "Optimized Message Implementations" has been updated to state:
A session provides the following methods to create messages: createMessage, createBytesMessage, createMapMessage,
createObjectMessage, createStreamMessage and createTextMessage.
These methods allow the JMS provider to create message implementations which are optimized for that particular
provider and allow the provider to minimize its overhead for handling messages.
A session provides message create methods that use provider-optimized implementations. This allows a provider to
minimize its overhead for handling messagesHowever .the fact that these methods are provided on a session does not mean
that messages must be sent using a message producer created from the same session. Messages may be sent using any
session, not just the session used to create the message.
Furthermore, Sessions must be capable of sending all JMS messages regardless of how they may be implemented. See
section 3.12 "Provider Implementations of JMS Message Interfaces".
Section 11.5.5 "11.5.5. Clarification: message may be sent using any session" is the change log for this clarification.