RE: Question: Duplicate strings
=?ks_c_5601-1987?B?v8DB9r/1?= <[email protected]>
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <000a01c2b6e1$225248f0$50340746@bigblue> |
> From: openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:openjms-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]On Behalf Of Tim Anderson
>
> It's done for specification compliance. From section 3.12 of
> the JMS spec:
>
> "The JMS message interfaces provide write/set methods for
> setting object
> values in a message body and message properties. All of
> these methods must
> be implemented to copy their input objects into the message."
>
> Off the top of my head, I can't think of a truly compelling
> reason why this
> is stated,
> other than to ensure provider interoperability eg, it would
> be wrong given
> the above for
> a client to make assumptions about the memory addresses of
> properties added:
>
> String foo = "foo";
> message.setStringProperty("bar", foo);
> if (message.getStringProperty("bar") == foo) {
> // should always be false on a compliant provider
> }
Strictly speaking, you're right.
But the purpose of the spec MAY BE mutable objects (particularly byte[]), not immutables.
These get(set) methods are related:
getJMSCorrelationIDAsBytes, getJMSReplyTo, getJMSDestination, getBytes, getObject
--
OH Jiung [email protected]
Samsung SDS