You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Turret <Ho...@Sun.com> on 2007/06/06 16:40:01 UTC
JMS and ActiveMQ lingering transports and scheduler threads cause a
Java out of memory error
I am running Spring 2.0.5 with ActiveMQ 4.1.1 as my JMS provider under Java
1.6u1.
I have noticed lingering ActiveMQ Transport and ActiveMQ Scheduler threads
within a running JVM via the jconsole utility. These threads are ever
increasing and never seem to be reaped by the garbage collector. I am using
a very simple send and receive queue messaging protocol. This after a heavy
pounding of messaging will cause the ActiveMQ server to report a Java out of
memory error!!! I have waited many minutes to see if they are release after
a long period of no activity, but to no avail.
Here are my XML config files:
<!-- A Pooled Based JMS Provider -->
<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFa
ctory">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFacto ry">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsFactory"/>
</bean>
Here is the code that sends and receives from the Queue:
public class TdeClient
{
private static String messageID = "1001";
private static Integer counter = 1;
private String myMessageID = null;
private JmsTemplate jmsTemplate = null;
private FileSystemXmlApplicationContext ctx = null;
private static final long JMS_TIMEOUT_FOREVER = -1;
private static Logger logger =
Logger.getLogger("com.sun.vtle.mq.TdeClient");
// Default Tde Request/Response Queues
private final static String requestQueue = "RequestQueue";
private final static String responseQueue = "ResponseQueue";
// Default constructor
public TdeClient()
{
// Setup the JMS enironment
setup();
}
public void setJmsTemplate(JmsTemplate jmsTemplate)
{
this.jmsTemplate = jmsTemplate;
}
// Setup the Spring bean for this class for database use
private void setup()
{
ctx = new FileSystemXmlApplicationContext("classpath:springB
eans/client-context.xml");
jmsTemplate = (JmsTemplate) ctx.getBean("jmsTemplate");
// Set Receive Timeout
jmsTemplate.setReceiveTimeout(JMS_TIMEOUT_FOREVER) ;
}
// Send JMS requests to the default TDE Request Queue
public void send(Request req)
{
myMessageID = getNextJMSMessageID();
// Send Request
jmsTemplate.convertAndSend(requestQueue, req, new MessagePostProcessor()
{
public Message postProcessMessage(Message message) throws JMSException
{
message.setJMSCorrelationID(myMessageID);
return message;
}
});
logger.debug("TdeClient: Sent[" + messageID + "] Request =" + req);
return;
}
// Receive JMS esponse from the default TDE Response Queue
public Response receive()
{
// Wait for Synchronous Response
// Use a Message Selector to only receive responses to the request you
// sent
String resSelectorId = "JMSCorrelationID='" + getCurrentJMSMessageID() +
"'";
Response resp = (Response)
jmsTemplate.receiveSelectedAndConvert(responseQueu e,
resSelectorId);
return resp;
}
// Create an UNIQUE message ID for the send message method
private String getNextJMSMessageID()
{
return messageID + counter++;
}
//
private String getCurrentJMSMessageID()
{
return myMessageID;
}
}
Any thoughts or suggestions are gratefully welcome!!!
Is this an issue with the configuration of the ActiveMQ product? my Spring
setup?
Thanks again!
:,(
--
View this message in context: http://www.nabble.com/JMS-and-ActiveMQ-lingering-transports-and-scheduler-threads-cause-a-Java-out-of-memory-error-tf3878335s2354.html#a10989961
Sent from the ActiveMQ - User mailing list archive at Nabble.com.