User: chirino
Date: 01/06/25 19:40:11
Modified: src/main/org/jboss/test/cts/jms MsgSender.java
Log:
When this class was being used by beans, it was being closed when the
bean was passivated. But the passivation would never occur (Not sure why not)
But this was causing a leak of JBossMQ connections (an thus a thread leak).
The send method now creates the connection, and closes the connection.
Revision Changes Path
1.2 +8 -11 jbosstest/src/main/org/jboss/test/cts/jms/MsgSender.java
Index: MsgSender.java
===================================================================
RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cts/jms/MsgSender.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MsgSender.java 2001/03/02 03:11:28 1.1
+++ MsgSender.java 2001/06/26 02:40:11 1.2
@@ -20,14 +20,6 @@
public MsgSender ( )
{
- try
- {
- init( new InitialContext(), QUEUE);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- }
}
/**
@@ -58,20 +50,25 @@
public void close()
throws JMSException
{
- qsender.close();
- qsession.close();
- qcon.close();
+ if( qcon != null ) {
+ qsender.close();
+ qsession.close();
+ qcon.close();
+ qcon = null;
+ }
}
public void sendMsg( String message )
{
try
{
+ init( new InitialContext(), QUEUE);
System.out.println("Sending a message.." );
qsender = qsession.createSender(queue);
msg = qsession.createTextMessage();
msg.setText(message);
qsender.send(msg);
+ close();
}
catch(Exception ex)
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development