[jboss-user] [JBoss Messaging] - Re: Receiving IllegalStateExceptions in client

bander do-not-reply at jboss.com
Wed Feb 14 17:40:19 EST 2007


We're not using multiple threads per session.

On the receiving side (where this exception has been thrown), a single thread is used to create 5 sessions. Each session has a single consumer. 

The relevant receiving code is as follows:


  | setConnectionFactory(getConnectionFactoryStrategy()
  | 		.createConnectionFactory());
  | LOG.info(getName() + " JMS connection factory created");
  | LOG.info(getName() + " creating JMS connection");
  | connection = getConnectionFactory().createConnection();
  | connection.setExceptionListener(//
  | 		createExceptionListener(manager));
  | LOG.info(getName() + " JMS connection created");
  | LOG.info(getName() + " creating "
  | 		+ getNumberOfProcesses()
  | 		+ " message consumer processes");
  | consumers = new MessageConsumer[getNumberOfProcesses()];
  | sessions = new Session[getNumberOfProcesses()];
  | 
  | for (int x = 0; x < consumers.length; x++) {
  | 	if (LOG.isDebugEnabled()) {
  | 		LOG.debug(getName()
  | 				+ " starting receive process " + x);
  | 	}
  | 	sessions[x] = connection.createSession(false,
  | 			Session.AUTO_ACKNOWLEDGE);
  | 	Queue q = sessions[x].createQueue(getQueueName());
  | 
  | 	consumers[x] = sessions[x].createConsumer(q);
  | 	consumers[x]
  | 			.setMessageListener(createMessageListener(
  | 					sessions[x], x));
  | 	if (LOG.isDebugEnabled()) {
  | 		LOG.debug(getName() + " receive process " + x
  | 				+ " started");
  | 	}
  | }
  | LOG.info(getName() + " starting JMS connection");
  | connection.start();
  | 
  | 

Each of our queues has it's own thread to create these sessions but once created they are only accessed by that thread. 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016705#4016705

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016705



More information about the jboss-user mailing list