jsr343-experts@jms-spec.java.net

[jsr343-experts] Re: [jms-spec users] Re: Re: QueueBrowser.getEnumeration

From: <reza_rahman_at_lycos.com>
Date: Mon, 9 Jan 2012 19:02:13 +0000 (GMT)
I don't think there is a significant need for this.

Jan 9, 2012 01:40:18 PM, jsr343-experts@jms-spec.java.net wrote:
Given that a QueueBrowser already provides a method to return an Enumeration, what would be the benefit in additionally returning a Iterator (unless we wanted to add support for remove())?

Nigel

On 09/01/2012 16:32, RĂ¼diger zu Dohna wrote:
Maybe it should return an Iterator? ... deliberately not an Iterable! This would make it clear that it's just a snapshot and there's no much use to pass it as a collection around.


On 2012-01-09, at 15:01, Nigel Deakin wrote:

John,

Simply returning a Set isn't very scalable: a queue might contain thousands (or hundreds of thousands) of messages. That's why the existing API returns an Enumeration.

(Also, since a Queue is by definition ordered, returning a Set would be throwing away important semantics)

Nigel

On 09/01/2012 13:40, John D. Ament wrote:
Hi Nigel,

No, I would leave the existing method, and add a new one:

public Set getMessages() throws JMSRuntimeException { }

I think Set is most appropriate, since the messages should be unique.

On Mon, Jan 9, 2012 at 7:06 AM, Nigel Deakin <nigel.deakin@oracle.com> wrote:
John,


On 06/01/2012 10:49, John D. Ament wrote:
It may be a bit late, but is it possible for us to provide a set or list back that is properly typed (e.g.
javax.jms.Message) from QueueBrowser?

Can you be more specific about what you are asking for?

Are you asking for the existing method
   Enumeration  getEnumeration() throws JMSException;
to be changed to
   Enumeration getEnumeration() throws JMSException;

or something else?

Nigel