-
1. Re: Ping Warnings
joelvogt Dec 10, 2002 4:58 PM (in response to pragneshray)how are you going about closing the connection on the client side?
-
2. Re: Ping Warnings
pragneshray Dec 10, 2002 5:24 PM (in response to pragneshray)Here is the code snippet
....
QueueConnection conn;
QueueSession session;
....
try {
if (session != null) session.close();
if (conn != null) {
conn.stop();
conn.close();
}
} catch(Exception e) {
} -
3. Re: Ping Warnings
joelvogt Dec 10, 2002 9:14 PM (in response to pragneshray)ok, is this code wrapped in an exception listener or is it at the end of a loop etc?
-
4. Re: Ping Warnings
jimvoris Dec 11, 2002 3:17 PM (in response to pragneshray)The ping thread never gets killed on a broken connection, so you get the messages you note above forever.... at least that's what I saw.
I fixed the problem by killing the ping thread in the circumstance that the connection failed.
I tried sending the patch to someone on the JMS team, but I'm not sure that it went anywhere, or if I sent it to the right person.
In any case, I've attached a patched Connection.java (in the org.jboss.mq package in the messaging sub-system).
Look at line 1171 and the code following that to see what I changed. -
5. Re: Ping Warnings
pragneshray Dec 11, 2002 4:39 PM (in response to pragneshray)Its within exception listener.
try {
ObjectMessage msg = session.createObjectMessage();
msg.setObject(event);
send.send(msg);
} catch(Exception e) {
close_Connection(); //got error reset connections
}
close_Connection()method contains the close session and close connection calls.
Thanks -
6. Re: Ping Warnings
pragneshray Dec 11, 2002 4:41 PM (in response to pragneshray)Its within exception listener.
try {
ObjectMessage msg = session.createObjectMessage();
msg.setObject(event);
send.send(msg);
} catch(Exception e) {
close_Connection(); //got error reset connections
}
close_Connection()method contains the close session and close connection calls.
Thanks -
7. Re: Ping Warnings
pragneshray Dec 11, 2002 4:42 PM (in response to pragneshray)Its within exception listener.
try {
ObjectMessage msg = session.createObjectMessage();
msg.setObject(event);
send.send(msg);
} catch(Exception e) {
close_Connection(); //got error reset connections
}
close_Connection()method contains the close session and close connection calls.
Thanks -
8. Re: Ping Warnings
pragneshray Dec 11, 2002 7:11 PM (in response to pragneshray)Exception listener.
-
9. Re: Ping Warnings
joelvogt Dec 11, 2002 9:19 PM (in response to pragneshray)try something like
public class MyExceptionListener
implements javax.jms.ExceptionListener
{
public void onException(JMSException e)
{
// Handle the problem here, close etc
try
{
if (session != null)
session.close();
if (conn != null)
{
conn.stop();
conn.close();
}
}
catch(Exception er)
{
logCat.error(er);
}
}
}
And
MyExceptionListener l = new MyExceptionListener();
topicConnection.setExceptionListener(l);
This should ensure if anything goes wrong with the connection it will be closed cleanly.