Return-Path: X-Original-To: apmail-qpid-users-archive@www.apache.org Delivered-To: apmail-qpid-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2848EFC22 for ; Sat, 6 Apr 2013 22:56:23 +0000 (UTC) Received: (qmail 96258 invoked by uid 500); 6 Apr 2013 22:56:22 -0000 Delivered-To: apmail-qpid-users-archive@qpid.apache.org Received: (qmail 96227 invoked by uid 500); 6 Apr 2013 22:56:22 -0000 Mailing-List: contact users-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@qpid.apache.org Delivered-To: mailing list users@qpid.apache.org Received: (qmail 96217 invoked by uid 99); 6 Apr 2013 22:56:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Apr 2013 22:56:22 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of robbie.gemmell@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Apr 2013 22:56:18 +0000 Received: by mail-vb0-f48.google.com with SMTP id p13so2905458vbe.7 for ; Sat, 06 Apr 2013 15:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=OyXdM6YSHBRYRaBV8BElblagIibFttTI2rOnDauekk4=; b=RS3J2CN8jZXZtEJn4cauRUP8EWmW8zqLktrB48ZRpcBwJYr182KTuMw8+kswgqydyp XKpXPT8Vj0yc4Ych1ZT9HonUZJKJ8KgPG6vSl4k04AuDQOGSBnmfwCf7RELG7VkdkV26 RoxV6k9hvnXP6ybcS774IQQLt3jUWDB6Ax7znu4oNFUpCrYuTqDMBAasxjj+sk13OlTm FBXCYYVyp6aeD+RglWdZ6Fh/96eFPexGi7pIC3t5okcslLQANAxLR+Du7Vrzd3qc615a lf//75276y927ijDiQKQ5OyvW8j4LZJ2f5re79pjPJOkCSGmGu24VHVSeNxgDrcTFo7S T2fQ== MIME-Version: 1.0 X-Received: by 10.220.70.77 with SMTP id c13mr11890884vcj.43.1365288957908; Sat, 06 Apr 2013 15:55:57 -0700 (PDT) Received: by 10.58.241.204 with HTTP; Sat, 6 Apr 2013 15:55:57 -0700 (PDT) In-Reply-To: References: Date: Sat, 6 Apr 2013 23:55:57 +0100 Message-ID: Subject: Re: Java JMS client eating InterruptedException From: Robbie Gemmell To: "users@qpid.apache.org" Content-Type: multipart/alternative; boundary=047d7b3a8d765a4cbb04d9b91b16 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b3a8d765a4cbb04d9b91b16 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Ales, It seems reasonable to raise a JIRA Robbie On 2 April 2013 16:55, Ale=C5=A1 Tr=C4=8Dek wrote: > Hi all! > > I am implementing proper stopping (with ExecutorService.shutdownNow()) of > a few worker threads I have, that are consuming messages from the queue a= ll > the time, and if there were no messages the threads wouldn't stop... > Thread.currentThread().isInterrupted() is always false. So after a little > bit of debugging I discovered that the problem lies in the fact that > receive method on MessageConsumer eats up the InterruptedException, which > clears isInterrupted flag. > Relevant code from BasicMessageConsumer.java: > public Message receive(long l) throws JMSException > { > ... > catch (InterruptedException e) > { > _logger.warn("Interrupted acquire: " + e); > if (isClosed()) > { > return null; > } > } > ... > catch (InterruptedException e) > { > _logger.warn("Interrupted: " + e); > > return null; > } > ... > } > > Even though the JMS standard does not specify how to handle such interrup= t > (JMSException or returning null message), I'm sure the implementation > shouldn't just ignore it (which is basically what happens). When catching > InterruptedException, the interrupted flag should immediately be set back > (Thread.currentThread().interrupt()), so in the calling code we can still > detect such situation. > Any other point of view on this subject, or should I file a bug? :) > > Btw: I got around this by not using timeout in receive() call, but I woul= d > be more comfortable if the Consumer would wait for messages for a while, > instead of me looping like crazy in my code... > > P.S.: Sorry if this should go to qpid-dev. > > > Regards, > Ales > --047d7b3a8d765a4cbb04d9b91b16--