Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 21046 invoked from network); 23 Nov 2009 20:08:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Nov 2009 20:08:15 -0000 Received: (qmail 94574 invoked by uid 500); 23 Nov 2009 20:08:15 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 94511 invoked by uid 500); 23 Nov 2009 20:08:15 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 94501 invoked by uid 99); 23 Nov 2009 20:08:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Nov 2009 20:08:15 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Nov 2009 20:08:12 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B3508234C04C for ; Mon, 23 Nov 2009 12:07:52 -0800 (PST) Message-ID: <466229722.1259006872698.JavaMail.jira@brutus> Date: Mon, 23 Nov 2009 12:07:52 -0800 (PST) From: "Dave Stanley (JIRA)" To: dev@activemq.apache.org Subject: [jira] Created: (AMQ-2507) When using a producer/session with a send timeout, send() doesn't throw an exception if the timeout is reached. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c When using a producer/session with a send timeout, send() doesn't throw an exception if the timeout is reached. --------------------------------------------------------------------------------------------------------------- Key: AMQ-2507 URL: https://issues.apache.org/activemq/browse/AMQ-2507 Project: ActiveMQ Issue Type: Improvement Components: Broker Affects Versions: 5.3.0 Environment: All platforms, 5.3.x Reporter: Dave Stanley In the attached testcase we set a low broker memory limit (to force a producer to block due to the memory usage limit being hit), and also set a sendtimeout on the connection to force the producer.send() to return if it cannot send a message within the timeout period. On running the test the broker sends messages until the timeout kicks in. Once the hits the memory limit it blocks and the producer.send() returns after the timeout. The problem is there is no way to know that the send() failed. This improvement is to modify the session to throw an exception of some kind when the sendTimeout is reached. I have attached the testcase without a fix as its not clear the best approach to fix. One possible solution is to modify ActiveMQSession, but need some clarification on whats the best JMSException to throw. It doesn't look like this is explicitly spelled out in the JMS Spec. General area is the send() method protected void send(ActiveMQMessageProducer producer, ActiveMQDestination destination, Message message, int deliveryMode, int priority, long timeToLive, MemoryUsage producerWindow, int sendTimeout) throws JMSException { ..... if (sendTimeout <= 0 && !msg.isResponseRequired() && !connection.isAlwaysSyncSend() && (!msg.isPersistent() || connection.isUseAsyncSend() || txid != null)) { this.connection.asyncSendPacket(msg); if (producerWindow != null) { // Since we defer lots of the marshaling till we hit the // wire, this might not // provide and accurate size. We may change over to doing // more aggressive marshaling, // to get more accurate sizes.. this is more important once // users start using producer window // flow control. int size = msg.getSize(); producerWindow.increaseUsage(size); } } else { // Handle send timeout here if (sendTimeout > 0) { Object response = this.connection.syncSendPacket(msg,sendTimeout); if(response == null) { LOG.debug(getSessionId() + " timeout sending message: " + msg); } // What jms exception is most appropriate to throw here? }else { this.connection.syncSendPacket(msg); } } } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.