This content has been marked as final.
Show 4 replies
-
1. Re: Messaging Timeout thread pool limits configuration
amalcaraz Nov 26, 2007 10:15 AM (in response to amalcaraz)Sorry,
I have forgotten the unit test:public class StressDeadLock { static final int MAX_MESSAGES = 4* 1000; static final int MAX_ROLLBACK_MESSAGES = 5; static final int DELAY_TIME = 60000; static final String HOST_NAME = "nostromo"; static final String QUEUE_NAME = "/queue/QueueWithOwnRedeliveryDelay"; @Test public void stressTest1() { InitialContext ctx = null; ConnectionFactory connectionFactory = null; Queue destination = null; Connection sdnConnection = null; Connection rcvConnection = null; Session sndSession = null; Session rcvSession = null; MessageProducer producer = null; MessageConsumer consumer = null; String body = "Message schedule test"; try { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.PROVIDER_URL, HOST_NAME + ":1099"); props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); ctx = new InitialContext(props); connectionFactory = (ConnectionFactory) ctx .lookup("/ConnectionFactory"); destination = (Queue) ctx.lookup(QUEUE_NAME); sdnConnection = connectionFactory.createConnection(); sndSession = sdnConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); rcvConnection = connectionFactory.createConnection(); rcvConnection.start(); rcvSession = rcvConnection.createSession(true, Session.SESSION_TRANSACTED); consumer = rcvSession.createConsumer(destination); producer = sndSession.createProducer(destination); long deliveryTime = System.currentTimeMillis() + DELAY_TIME; int msgCounter = 0; int rollbackCounter = 0; while (msgCounter < MAX_MESSAGES) { TextMessage msg = sndSession.createTextMessage(body); msg.setLongProperty( JBossMessage.JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME, deliveryTime); producer.send(msg); msgCounter++; System.out.println("Sending " + msgCounter + "..."); } while (consumer.receive(DELAY_TIME) != null) { if (rollbackCounter < MAX_ROLLBACK_MESSAGES) { rcvSession.rollback(); rollbackCounter++; } else { rcvSession.commit(); } msgCounter--; System.out.println("Pending for receive " + msgCounter + "..."); } assertFalse(msgCounter > (-1 * rollbackCounter)); } catch (Exception e) { fail(e.getMessage()); } finally { if (consumer != null) { try { consumer.close(); } catch (Exception e) { } } if (producer != null) { try { producer.close(); } catch (Exception e) { } } if (sndSession != null) { try { sndSession.close(); } catch (Exception e) { } } if (rcvSession != null) { try { rcvSession.close(); } catch (Exception e) { } } if (rcvConnection != null) { try { rcvConnection.close(); } catch (Exception e) { } } if (sdnConnection != null) { try { sdnConnection.close(); } catch (Exception e) { } } if (ctx != null) { try { ctx.close(); } catch (Exception e) { } } } } }
-
2. Re: Messaging Timeout thread pool limits configuration
amalcaraz Nov 26, 2007 5:53 PM (in response to amalcaraz)I have created a new feature request: JBMESSAGING-1163.
-
3. Re: Messaging Timeout thread pool limits configuration
timfox Nov 28, 2007 6:49 AM (in response to amalcaraz)I have put in a small change to make the queue unlimited for SP2.
Not sure if we really need full configurability? -
4. Re: Messaging Timeout thread pool limits configuration
amalcaraz Nov 28, 2007 7:47 AM (in response to amalcaraz)Hi Tim,
in our production environment I have deployed an unbounded version of MessagingTimeoutFactory.
I think it is a future feature in order to limit resource consumption in small computers or for testing purposes (I use it for this).