Skip to main content

[jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()

  • From: Nigel Deakin <nigel.deakin@...>
  • To: jsr343-experts@...
  • Subject: [jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()
  • Date: Fri, 08 Feb 2013 15:44:24 +0000
  • List-id: <jsr343-experts.jms-spec.java.net>
  • Organization: Oracle Corporation

I think it's time to resolve the issue of whether Set returned by JMSProducer#getPropertyNames (which returns all the property names configured on the JMSProducer) should be

(1) a copy

(2) a "live" set backed by the underlying JMSProducer, as created using 
map.keySet()
Map.keySet is defined here
http://docs.oracle.com/javase/7/docs/api/java/util/Map.html#keySet%28%29

(3) a "live" set backed by the JMSProducer whereby changing the changing the JMSProducer will change the Set but where any attempt to change the Set would throw an exception, as created using Collections.unmodifiableSet(set).
Collections.unmodifiableSet is defined here
http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#unmodifiableSet%28java.util.Set%29

My preference is (2).

The only other people who expressed a view were John Ament and Rüdiger who 
were keen on (3).

Conclusion
----------

I don't feel strongly about this, and it doesn't look as if anyone else does, so I'm going to go along with John and Rüdiger. My rationale is that a JMSProducer is a short-lived object and so there's isn't any need for API to remove properties (which this would be). There already isn't any method on JMSProducer to remove an individual property (and although I added a JMSProducer.clearProperties it isn't really needed either).

So the new javadoc will be (3)

-----------------------------------------------------------------------------------------
Set<String> getPropertyNames()

Returns an unmodifiable Set view of the names of all the message properties 
that have been set on this JMSProducer.

Note that JMS standard header fields are not considered properties and are 
not returned in this Set.

The set is backed by the JMSProducer, so changes to the map are reflected in the set. However the set may not be modified. Attempts to modify the returned collection, whether directly or via its iterator, will result in an UnsupportedOperationException. Its behaviour matches that defined in the java.util.Collections method unmodifiableSet.

Returns:
    a Set containing the names of all the message properties that have been 
set on this JMSProducer
Throws:
    JMSRuntimeException - if the JMS provider fails to get the property names 
due to some internal error.
See Also:
    Collections.unmodifiableSet()
-----------------------------------------------------------------------------------------

I hope this is OK by everyone.

Nigel


[jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()

Nigel Deakin 02/01/2013

[jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()

John D. Ament 02/01/2013

[jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()

Nigel Deakin 02/08/2013

[jms-spec users] [jsr343-experts] Re: Re: JMS 2.0 Late update: JMSProducer.getPropertyNames()

Nigel Deakin 02/08/2013
 
 
Close
loading
Please Confirm
Close