activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From flockilan <f.lan...@gmx.de>
Subject ActiveMQConnectionFactory doesn't release Connection resources ... ?!
Date Fri, 13 Oct 2006 14:05:02 GMT

Hello everyone

I'm working on a dispatcher-like service. It has to re-connect all its
"channels" (socket, messaging, ...) on error or after a given idle time.
After having performed several thousands of reconnects (1min idle threshold,
non-work weekend) it stopped with a "java heap space" exception.

The trace lead me to the JMS producer that raised that Exception when trying
to open a session.

I did some tests and the following snippet reproduces the behaviour. (Setup
the vm to 64Meg max heap size to see the results within minutes). I'm using
the current ActiveMQ Dist 4.02 out of the box on WinXP SP2 with Java 1.507.

-- code --

public static void main(String[] args) throws Exception {
    ActiveMQConnectionFactory conFactory = new ActiveMQConnectionFactory
("dummy", "dummy", "tcp://127.0.0.1:61616");
    Connection con;
    try {
      while (true) {
        //conFactory = new ActiveMQConnectionFactory ("dummy", "dummy",
"tcp://127.0.0.1:61616"); // uncomment this to avoid the exception
        con = conFactory.createConnection();
        System.out.println("Connection created.");
        con.close();
        con = null;
        Thread.sleep(50);
        System.gc();
      } 
    } catch (Throwable t) {
      System.out.println(t.getMessage());
    }
  }

-- code --



When a new Factory is created in every loop (the commented line) then the
heap size stays on a normal level.


Does the Factory some kind of pooling ?
Is this the standard behaviour, and do I have to instatiate a new Factory on
each and every Connection attempt ?
Is it a Bug ?


I know that this is a strange use of establishing connections, but I would
like to know the reason... And know if I have to change my use of the
Factory, or just supply a special parameter or whatever.


Thanks in advance.
-- 
View this message in context: http://www.nabble.com/ActiveMQConnectionFactory-doesn%27t-release-Connection-resources-...--%21-tf2437249.html#a6796189
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message