Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 24D4CC3DA for ; Fri, 14 Mar 2014 15:08:20 +0000 (UTC) Received: (qmail 24035 invoked by uid 500); 14 Mar 2014 15:08:00 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 23800 invoked by uid 500); 14 Mar 2014 15:07:53 -0000 Mailing-List: contact commits-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 commits@activemq.apache.org Received: (qmail 23257 invoked by uid 99); 14 Mar 2014 15:07:43 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 15:07:43 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F1F25981BDB; Fri, 14 Mar 2014 15:07:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hadrian@apache.org To: commits@activemq.apache.org Date: Fri, 14 Mar 2014 15:07:46 -0000 Message-Id: In-Reply-To: <2fe6fd83c38b4e688a7139297ba565e1@git.apache.org> References: <2fe6fd83c38b4e688a7139297ba565e1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/23] git commit: https://issues.apache.org/jira/browse/AMQ-4958 https://issues.apache.org/jira/browse/AMQ-4958 Don't swallow evidence of interrupted state. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/2f852a7e Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/2f852a7e Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/2f852a7e Branch: refs/heads/activemq-5.9 Commit: 2f852a7e7ee96218d0ad7b4ef7cc8222d6ea0665 Parents: dbbcba7 Author: Timothy Bish Authored: Mon Jan 6 11:49:38 2014 -0500 Committer: Hadrian Zbarcea Committed: Fri Mar 14 10:54:26 2014 -0400 ---------------------------------------------------------------------- .../java/org/apache/activemq/util/IdGenerator.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/2f852a7e/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java ---------------------------------------------------------------------- diff --git a/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java b/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java index 844847a..3bf10a5 100755 --- a/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java +++ b/activemq-client/src/main/java/org/apache/activemq/util/IdGenerator.java @@ -33,7 +33,7 @@ public class IdGenerator { private static int instanceCount; private static String hostName; private String seed; - private AtomicLong sequence = new AtomicLong(1); + private final AtomicLong sequence = new AtomicLong(1); private int length; public static final String PROPERTY_IDGENERATOR_PORT ="activemq.idgenerator.port"; @@ -59,11 +59,16 @@ public class IdGenerator { ss = new ServerSocket(idGeneratorPort); stub = "-" + ss.getLocalPort() + "-" + System.currentTimeMillis() + "-"; Thread.sleep(100); - } catch (Exception ioe) { + } catch (Exception e) { if (LOG.isTraceEnabled()) { - LOG.trace("could not generate unique stub by using DNS and binding to local port", ioe); + LOG.trace("could not generate unique stub by using DNS and binding to local port", e); } else { - LOG.warn("could not generate unique stub by using DNS and binding to local port: {} {}", ioe.getClass().getCanonicalName(), ioe.getMessage()); + LOG.warn("could not generate unique stub by using DNS and binding to local port: {} {}", e.getClass().getCanonicalName(), e.getMessage()); + } + + // Restore interrupted state so higher level code can deal with it. + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); } } finally { if (ss != null) {