Reverting change to IdBlockGenerator that caused NPE when installing flows.
Change-Id: I86ff72d0cd4560dec2c2a1ce4bf97473d36447bf
Showing
1 changed file
with
7 additions
and
9 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 | - return idBlock.getNextId(); | 49 | + if (!initialized.get()) { |
50 | - } catch (UnavailableIdException e) { | ||
51 | synchronized (allocator) { | 50 | synchronized (allocator) { |
51 | + if (!initialized.get()) { | ||
52 | idBlock = allocator.allocateUniqueIdBlock(); | 52 | idBlock = allocator.allocateUniqueIdBlock(); |
53 | + initialized.set(true); | ||
54 | + } | ||
55 | + } | ||
53 | } | 56 | } |
54 | return idBlock.getNextId(); | 57 | return idBlock.getNextId(); |
55 | - } catch (NullPointerException e) { | 58 | + } catch (UnavailableIdException e) { |
56 | synchronized (allocator) { | 59 | synchronized (allocator) { |
57 | - if (!initialized.get()) { | ||
58 | idBlock = allocator.allocateUniqueIdBlock(); | 60 | idBlock = allocator.allocateUniqueIdBlock(); |
59 | - initialized.set(true); | ||
60 | - return idBlock.getNextId(); | ||
61 | - } else { | ||
62 | - throw e; | ||
63 | - } | ||
64 | } | 61 | } |
62 | + return idBlock.getNextId(); | ||
65 | } | 63 | } |
66 | } | 64 | } |
67 | } | 65 | } | ... | ... |
-
Please register or login to post a comment