[
https://issues.apache.org/jira/browse/TOMEE-2770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17035188#comment-17035188
]
François Courtault commented on TOMEE-2770:
-------------------------------------------
It's really easy to reproduce.
Just this class to be deploy in a war:
@Stateless
@Path("v1/notifications")
public class NotificationResource {
public static final String QUEUE_NAME = "jms/myQueue";
@Resource(name = QUEUE_NAME)
private Queue messageQueue;
@Inject
private JMSContext jmsContext;
@GET
@Path("downloadInfo")
public Response postDownloadInfoJMS() {
jmsContext.createProducer().send(messageQueue,
jmsContext.createTextMessage("Test"));
System.out.println("Message sent !");
return Response.accepted().build();
}
}
And a beans.xml with bean-discovery-mode="all".
Then perform several GET calls with a browser and you will the number of
dynamicProducer increase (1 per call).
> ActiveMQ dynamic producer not destroyed
> ---------------------------------------
>
> Key: TOMEE-2770
> URL: https://issues.apache.org/jira/browse/TOMEE-2770
> Project: TomEE
> Issue Type: Bug
> Components: TomEE Core Server
> Affects Versions: 8.0.0-Final, 8.0.1
> Reporter: François Courtault
> Priority: Blocker
>
> Hello,
> In an stateless EJB, I inject JMSContext (working) and in a method, I have
> the following code:
> *jmsContext*.createProducer().send(*messageQueue*,
> *jmsContext*.createTextMessage(*"Test"*));
> The issue I have is that each time I send a text message a DynamicProducer is
> created which could be the root cause of a memory leak.
> I don’t get that because, according to the JMS 2.0 specification, the
> JMSContext injected has a Transaction scope => this mean that after the end
> of the method, the JMSContext should be closed so that the dynamic producer:
> this is not I am seing :(
>
> Best Regards.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)