Updated Branches: refs/heads/trunk 97b12c724 -> 04c6d9dd6
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/04c6d9dd Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/04c6d9dd Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/04c6d9dd Branch: refs/heads/trunk Commit: 04c6d9dd69402038d78104f1cc48c22e30edfddc Parents: 97b12c7 Author: Timothy Bish <[email protected]> Authored: Mon Jan 6 11:49:38 2014 -0500 Committer: Timothy Bish <[email protected]> Committed: Mon Jan 6 11:49:38 2014 -0500 ---------------------------------------------------------------------- .../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/04c6d9dd/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) {
