You are seeing two different things:
1) UIL2 uses a thread pool.
This thread pool is not being shutdown when you close the connection
so you have to wait 60 seconds for the threadpool itself to reap
the threads or more probably at garbage collection.
This is a bug, I will fix it.
2) If you use the default stacksize on Linux (8M) you'll find
you can't create very many threads.
This will show up as an OutOfMemoryException.
Dropping the stack size will allow you create
many more threads. Alter the ulimit command in run.sh
8M is a bit much for java which allocates most memory on the heap.
P.S. Opening and closing connections for every send isn't
very efficient. :-)
It is much more efficient to share one connection and use
multiple sessions or use a pool of already open connections/sessions.
Regards,
Adrian
On Fri, 2003-12-19 at 09:05, Didi Posselt wrote:
Hi folks,
If I create QueueConnections with a UIL2ConnectionFactory, a new thread
seems to be generated for this QueueConnection. However, if I close this
QueueConnection, the thread seems to live for another minute or so.
I'm running a linux box with JDK-1.4.2 and JBoss-3.2.3RC1.
I guess this is due to the PingPeriod of 6 in uil2-service.xml, however,
since I close the QueueConnection I expect the thread to disappear
immediately.
I wrote a stand alone graphical tool to manage our jms queues and messages
on the server. I got OutOfMemory-failures on the server pretty often and I
quess this is bound to the extra threads since sometimes I create
QueueConnections for any message in the queue (e.g. to resend messages
from the DLQ to the original destination, which might be different for the
messages).
I wrote a small example application which easily shows the bug (or is this a
feature?).
posselt in pingu (164) [0] cat UIL2Bug.java
import java.util.Properties;
import javax.naming.InitialContext;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
public class UIL2Bug {
public static void main(String args[]) {
Properties properties;
InitialContext jndiContext;
QueueConnectionFactory queueFactory;
QueueConnection queueConnection;
int i;
queueConnection = null;
if (args.length!=1) {
System.out.println(USAGE: java UIL2Bug jndi-url);
System.exit(-1);
}
properties = new Properties();
properties.setProperty(java.naming.factory.initial,
org.jnp.interfaces.NamingContextFactory);
properties.setProperty(java.naming.provider.url, args[0]);
try {
jndiContext = new InitialContext(properties);
queueFactory = (QueueConnectionFactory)
jndiContext.lookup(UIL2ConnectionFactory);
for (i=0; i500; i++) {
queueConnection = queueFactory.createQueueConnection();
queueConnection.close();
queueConnection = null;
}
} catch (Exception ex) {
System.out.println(Exception while browsing the queue: +
ex.getMessage());
}
if (queueConnection!=null) {
try {
queueConnection.close();
} catch (Exception ex) {
System.out.println(Warning: Exception while closing
queueConnection: + ex.getMessage());
}
}
}
}
posselt in pingu (165) [0] setenv CLASSPATH
${HOME}/jboss/jboss-src/jboss-3.2.3RC1-src/build/output/jboss-3.2.3RC1/client/jbossall-client.jar:.
posselt in pingu (166) [0] javac UIL2Bug.java
posselt in pingu (167) [0] echo -n TIME: `date +'%H:%M:%S'` THREADS: ;
ps -ef | grep org.jboss | wc -l
TIME: 09:54:51 THREADS: 100
posselt in pingu (168) [0] java UIL2Bug localhost:1099
posselt in pingu (169) [0] echo -n TIME: `date +'%H:%M:%S'` THREADS: ;
ps -ef | grep org.jboss | wc -l
TIME: 09:55:04 THREADS: 673
posselt in pingu (170) [0] echo -n TIME: `date +'%H:%M:%S'` THREADS: ;
ps -ef | grep org.jboss | wc -l
TIME: 09:55:50 THREADS: 674
posselt in pingu (171) [0] echo -n TIME: `date +'%H:%M:%S'` THREADS: ;
ps -ef | grep org.jboss | wc -l
TIME: 09:56:04 THREADS: 100
posselt in pingu (172) [0]
Grtngs,
Dietmar
--
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC
---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]