Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 94791 invoked from network); 16 Apr 2007 07:46:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2007 07:46:25 -0000 Received: (qmail 43746 invoked by uid 500); 16 Apr 2007 07:46:30 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 43721 invoked by uid 500); 16 Apr 2007 07:46:30 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 43712 invoked by uid 99); 16 Apr 2007 07:46:30 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Apr 2007 00:46:30 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of james.strachan@gmail.com designates 66.249.82.235 as permitted sender) Received: from [66.249.82.235] (HELO wx-out-0506.google.com) (66.249.82.235) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Apr 2007 00:46:24 -0700 Received: by wx-out-0506.google.com with SMTP id h29so1564763wxd for ; Mon, 16 Apr 2007 00:46:03 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nU0DfP+QaXxGfncI7jAlQu1+f+tvvoFtBSq11ikt2lEGqZVSI/IJZXDIdk2NArY+TWYH9UOH+hYOfe/OSYt0a6/CgtvgMKhk+XiO01EHkL8EEXsFqWRxy9x8LWqhn9PgdUWN6ZAbSkYjBJ2QOv+/bvg0sFUYsiVH1qPFAU+A2NU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sRgme94EdZ/OoJjryJypW0kT8UYJGmXMyarweMVx8Wm3FYry7JUZC54ATqzhs3rMEh9TW1BF18Lq6ZYKSgMG3yB3cXy8kHSvEdzwHFPluaFuYhlEk1BTETiMXo5pmDZbj5LUJwbjp72KnJ1cHnJVZJHxSKyYy6CDisqC+4rVzYo= Received: by 10.90.84.17 with SMTP id h17mr4572685agb.1176709563356; Mon, 16 Apr 2007 00:46:03 -0700 (PDT) Received: by 10.90.105.4 with HTTP; Mon, 16 Apr 2007 00:46:03 -0700 (PDT) Message-ID: Date: Mon, 16 Apr 2007 08:46:03 +0100 From: "James Strachan" To: users@activemq.apache.org Subject: Re: messageListener, ASYNC, and threads in "onMessage()" In-Reply-To: <10002299.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <10002299.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org A JMS provider will only invoke a MessageListener on a JMS MessageConsumer by one thread at once. Indeed; a JMS provider will invoke the MessageListener on all MessageConsumer's in a given Session by a single thread at once. On 4/15/07, robr wrote: > > i read the post at : > http://www.nabble.com/-activemq-user--two-threads-per-session-tf476901s2354.html#a1298138 > which suggests an extra thread around the onMessage dispatcher. We have > occaisional issues in the scope of our 3.1 implementation of "onMessage()" > that could be cause by non-thread-safe code on a file Access. These could be > issues that only come up when the broker gets very busy as they affect only > 5 - 10% of our message flow. > > I dont completely understand whether there are , in fact , multiple threads > that call onMessage? The javax.jms api says there is only 1. > http://java.sun.com/javaee/5/docs/api/javax/jms/MessageListener.html > > Other posts suggest that when using listeners and ASYNC that you should be > prepared to have a 2nd onMessage call dispatched before the prior call has > finished. So , your call stak from onMessage should be thread-safe. > > I've decided to review the code and to make sure that we are not throwing > exceptions in the scope of "onMessage" and to protect the obvious objects in > case there is m-thread issue... but i dont really know... > > comments appreciated > -- > View this message in context: http://www.nabble.com/messageListener%2C-ASYNC%2C-and-threads-in-%22onMessage%28%29%22-tf3579500s2354.html#a10002299 > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > -- James ------- http://radio.weblogs.com/0112098/