users@jms-spec.java.net

[jms-spec users] Re: Make TemporaryQueue/Topic AutoCloseable?

From: Philippe Marschall <kustos_at_gmx.net>
Date: Thu, 03 Jan 2013 23:21:42 +0100

On 03.01.2013 17:58, Nigel Deakin wrote:
> Philippe,
>
> On 02/01/2013 16:29, Philippe Marschall wrote:
>> I wanted to ask whether it would make sense to make TemporaryQueue and
>> TemporaryTopic implement AutoCloseable so that they can be used in a
>> try-with-resources block?
>
> Thanks for your comment.
>
> TemporaryQueue and TemporaryTopic don't have a close method. A temporary
> queue or topic will be automatically deleted when the Connection (or
> JMSContext) used to create it is closed.
>
> Are you proposing that we add a close method to TemporaryQueue and
> TemporaryTopic which causes the temporary queue or topic to be deleted?

Yes, more or less. That would allow a TemporaryQueue/TemporaryTopic to
be used in a create/use/delete pattern with language support. Thinking
about it I'm not so sure anymore. Maybe I just want to use
try-with-resources wherever I can.

Cheers
Philippe