Skip to content

Commit

Permalink
Merge pull request #98 from jmesnil/HORNETQ-912_synchronize_hardwareA…
Browse files Browse the repository at this point in the history
…ddress

Hornetq 912 synchronize hardware address
  • Loading branch information
FranciscoBorges committed Apr 19, 2012
2 parents a1a3638 + 6cdf879 commit fef63b7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/org/hornetq/utils/UUIDGenerator.java
Expand Up @@ -260,10 +260,19 @@ private final byte[] getAddressBytes()
{
if (address == null)
{
address = UUIDGenerator.getHardwareAddress();
if (address == null)
// calling UUIDGenerator.getHardwareAddress() is a
// time-expensive operation, let make sure it is called
// only once
synchronized (this)
{
address = generateDummyAddress();
if (address == null)
{
address = UUIDGenerator.getHardwareAddress();
if (address == null)
{
address = generateDummyAddress();
}
}
}
}

Expand Down

0 comments on commit fef63b7

Please sign in to comment.