RE: Question: Duplicate strings
"Tim Anderson" <tima-k+1zm/[email protected]>
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <[email protected]> |
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
}
> -----Original Message-----
> From: openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> [mailto:openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]On Behalf Of ¿ÀÁö¿õ
> Sent: Tuesday, January 07, 2003 7:45 PM
> To: openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: [openjms-developer] Question: Duplicate strings
>
>
> All over the source codes (e g TextMessageImpl),
> strings are being copied:
>
> new String(originalString)
>
> What need to duplicate strings which are immutable?
>
> - jiung
>
> --
> OH Jiung [email protected]
> Samsung SDS
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> openjms-developer mailing list
> openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/openjms-developer
>