From: Alex L. <lou...@ua...> - 2002-06-27 07:38:28
|
Hello G.L., So, if the message sent haven't been delivered or processing of the message haven't been started it's, probably, a correct behaviour. Reffer to api-docs for Connection.close(): "...Closing a connection causes all temporary destinations to be deleted. When this method is invoked, it should not return until message processing has been shut down in an orderly fashion. This means that all message listeners that may have been running have returned, and that all pending receives have returned. A close terminates all pending message receives on the connection's sessions' consumers. The receives may return with a message or with null, depending on whether there was a message available at the time of the close. If one or more of the connection's sessions' message listeners is processing a message at the time when connection close is invoked, all the facilities of the connection and its sessions must remain available to those listeners until they return control to the JMS provider. Closing a connection causes any of its sessions' transactions in progress to be rolled back. In the case where a session's work is coordinated by an external transaction manager, a session's commit and rollback methods are not used and the result of a closed session's work is determined later by the transaction manager. Closing a connection does NOT force an acknowledgment of client-acknowledged sessions..." Do I understand it wrongly? Hope this helps. alex Thursday, June 27, 2002, 10:05:42 AM, you wrote: GLG> Yeah, I'm closing it. Here's the actual producer code that I'm using. No GLG> exceptions from this method are thrown. Instead, they're thrown after this GLG> method returns and before my next line of code. It's pretty straight GLG> forwards as I use this code elsewhere also. The queue exists before this GLG> method is called. I can verify that on the agent view on 8082. GLG> --- snip --- GLG> public void assignToQueue(BuildObj bInfo) { GLG> Context ctx = null; GLG> Queue queue = null; GLG> QueueSender sender = null; GLG> QueueSession session = null; GLG> QueueConnection connection = null; GLG> QueueConnectionFactory connectionFactory = null; GLG> try { GLG> ctx = new InitialContext(); GLG> } GLG> catch (NamingException ne) { GLG> ne.printStackTrace(); GLG> log.error(Manager.class, "Could not create JNDI context"); GLG> } GLG> try{ GLG> connectionFactory = (QueueConnectionFactory) GLG> ctx.lookup("QueueConnectionFactory"); GLG> connection = connectionFactory.createQueueConnection(); GLG> session = connection.createQueueSession(false, GLG> Session.AUTO_ACKNOWLEDGE); GLG> connection.start(); GLG> System.out.println("queue/" + bInfo.getName()); GLG> queue = (Queue)ctx.lookup("queue/" + bInfo.getName()); GLG> sender = session.createSender(queue); GLG> ObjectMessage message = session.createObjectMessage(); GLG> message.setObject(bInfo); GLG> sender.send(queue, message); GLG> } GLG> catch (NamingException ne) { GLG> ne.printStackTrace(); GLG> log.error(Manager.class, ne.getMessage()); GLG> } GLG> catch (JMSException jmse) { GLG> jmse.printStackTrace(); GLG> log.error(Manager.class, jmse.getMessage()); GLG> } GLG> finally { GLG> try { GLG> if (session != null) { GLG> session.close(); GLG> } GLG> if (connection != null) { GLG> connection.close(); GLG> } GLG> } GLG> catch (Exception e) { GLG> log.error(Manager.class, e.getMessage()); GLG> } GLG> } GLG> return; GLG> } GLG> ----- Original Message ----- GLG> From: "Alex Loubyansky" <lou...@ua...> GLG> To: "G.L. Grobe" <ga...@gr...> GLG> Cc: <jbo...@li...> GLG> Sent: Thursday, June 27, 2002 1:44 AM GLG> Subject: Re: [JBoss-user] is this a JMS problem? >> Hello G.L., >> >> do you close the connection in the method? Could you detail what is done >> is the method? >> >> Wednesday, June 26, 2002, 11:11:02 PM, you wrote: >> >> GLG> I have a method A that creates a JMS producer to send a message to a >> GLG> consumer. After it completely returns from that method and before it >> GLG> executes my next line of code I get the following warning (and my >> GLG> message is never recv'd by the consumer). >> >> GLG> Anyone have any ideas how to go about figuring this out, what it may GLG> mean, anything? >> GLG> Any help much appreciated! >> GLG> --- >> >> GLG> [WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257, GLG> GlobalId=cassia//30, >> GLG> BranchQual=] errorCode=XAER_RMERR >> GLG> javax.transaction.xa.XAException >> GLG> at org.jboss.mq.SpyXAResource.commit(SpyXAResource.java:102) >> GLG> at GLG> org.jboss.tm.TxCapsule.commitResources(TxCapsule.java:1490) >> GLG> at org.jboss.tm.TxCapsule.commit(TxCapsule.java:324) >> GLG> at GLG> org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76) >> GLG> at >> GLG> GLG> org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:314) >> GLG> at >> GLG> GLG> org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons >> GLG> umer.java:565) >> GLG> at >> GLG> GLG> org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:376) >> GLG> at org.jboss.mq.SpySession.run(SpySession.java:248) >> GLG> at GLG> org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:172) >> GLG> at >> GLG> GLG> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja >> GLG> va:725) >> GLG> at java.lang.Thread.run(Thread.java:484) >> >> -- >> Best regards, >> Alex Loubyansky >> >> >> >> >> ------------------------------------------------------- >> Sponsored by: >> ThinkGeek at http://www.ThinkGeek.com/ >> _______________________________________________ >> JBoss-user mailing list >> JBo...@li... >> https://lists.sourceforge.net/lists/listinfo/jboss-user >> GLG> ------------------------------------------------------- GLG> Sponsored by: GLG> ThinkGeek at http://www.ThinkGeek.com/ GLG> _______________________________________________ GLG> JBoss-user mailing list GLG> JBo...@li... GLG> https://lists.sourceforge.net/lists/listinfo/jboss-user -- Best regards, Alex Loubyansky |