Reverting change to IdBlockGenerator that caused NPE when installing flows.
Change-Id: I86ff72d0cd4560dec2c2a1ce4bf97473d36447bf
Showing
1 changed file
with
8 additions
and
10 deletions
... | @@ -46,22 +46,20 @@ public class BlockAllocatorBasedIdGenerator implements IdGenerator { | ... | @@ -46,22 +46,20 @@ public class BlockAllocatorBasedIdGenerator implements IdGenerator { |
46 | @Override | 46 | @Override |
47 | public long getNewId() { | 47 | public long getNewId() { |
48 | try { | 48 | try { |
49 | + if (!initialized.get()) { | ||
50 | + synchronized (allocator) { | ||
51 | + if (!initialized.get()) { | ||
52 | + idBlock = allocator.allocateUniqueIdBlock(); | ||
53 | + initialized.set(true); | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
49 | return idBlock.getNextId(); | 57 | return idBlock.getNextId(); |
50 | } catch (UnavailableIdException e) { | 58 | } catch (UnavailableIdException e) { |
51 | synchronized (allocator) { | 59 | synchronized (allocator) { |
52 | idBlock = allocator.allocateUniqueIdBlock(); | 60 | idBlock = allocator.allocateUniqueIdBlock(); |
53 | } | 61 | } |
54 | return idBlock.getNextId(); | 62 | return idBlock.getNextId(); |
55 | - } catch (NullPointerException e) { | ||
56 | - synchronized (allocator) { | ||
57 | - if (!initialized.get()) { | ||
58 | - idBlock = allocator.allocateUniqueIdBlock(); | ||
59 | - initialized.set(true); | ||
60 | - return idBlock.getNextId(); | ||
61 | - } else { | ||
62 | - throw e; | ||
63 | - } | ||
64 | - } | ||
65 | } | 63 | } |
66 | } | 64 | } |
67 | } | 65 | } | ... | ... |
-
Please register or login to post a comment