[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - JBMESSAGING-541 - Multiple connections on a single thread wi
clebert.suconic@jboss.com
do-not-reply at jboss.com
Fri Sep 8 18:34:44 EDT 2006
I"ve opened this thread to discuss the creationg of DurableCrashTest1 and DurableCrashTest2.
If I have a client with two connections opened (don't know if the fact they are in the same thread matters or not), the lease timer stops and never comes back.
I've discovered this by adding a couple of log.info into JBossRemoting during leasing and stop leasing. And basically, during addCallBAck a new client is created/closed what stops the lease timer.
What is funny is with a single connection test, this works fine. (I mean the connection is detected without any problem)
I have also opened a JIRA on JBossRemoting:
http://jira.jboss.org/jira/browse/JBREM-596
public void testSimplestDurableSubscription() throws Exception
| {
| ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
| Topic topic = (Topic)ic.lookup("/topic/TopicCrash");
|
| Connection conn = cf.createConnection();
| conn.setClientID("client1");
| conn.start();
|
| Connection conn2 = cf.createConnection(); // funny... if I remove everything related to conn2, the lease thread works
| conn2.setClientID("client2");
| conn2.start();
|
| Session s = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
| Session s2 = conn2.createSession(true, Session.AUTO_ACKNOWLEDGE);
|
| MessageProducer prod = s.createProducer(topic);
| prod.setDeliveryMode(DeliveryMode.PERSISTENT);
|
| MessageConsumer durable = s.createDurableSubscriber(topic, "subs1");
| MessageConsumer durable2 = s2.createDurableSubscriber(topic, "subs2");
|
| //conn2.close(); -- do not remote this comment. It was meant to not close the connection
|
|
| for (int i=0;i<10;i++)
| {
| prod.send(s.createTextMessage("k"+i));
| }
| s.commit();
|
| conn.close();
| conn = cf.createConnection();
| conn.setClientID("client1");
| conn.start();
| s = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
| durable = s.createDurableSubscriber(topic, "subs1");
|
| for (int i=0;i<2;i++)
| {
| TextMessage tm = (TextMessage)durable.receive(1000);
| assertNotNull(tm);
| s.commit();
| System.out.println(tm.getText());
| assertEquals("k" + i, tm.getText());
| }
|
| //conn.close();-- do not remote this comment. It was meant to not close the connection
|
| //System.exit(0); -- this is not needed as there is not tearDown, the client VM will simply be finished the same way an exit would do, and this is better since it will keep proper JUNIT report outputs
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970472#3970472
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970472
More information about the jboss-dev-forums
mailing list