package net.onrc.onos.core.newintent;

import net.onrc.onos.api.newintent.IntentId;
import net.onrc.onos.api.newintent.IntentIdGenerator;
import net.onrc.onos.core.util.IdBlock;
import net.onrc.onos.core.util.UnavailableIdException;
import net.onrc.onos.core.util.IdBlockAllocator;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * An implementation of {@link IntentIdGenerator},
 * which uses {@link IdBlockAllocator#allocateUniqueIdBlock()}.
 */
public class IdBlockAllocatorBasedIntentIdGenerator implements IntentIdGenerator {

    private final IdBlockAllocator allocator;
    private IdBlock idBlock;

    /**
     * Constructs a {@link IdBlockAllocatorBasedIntentIdGenerator}.
     *
     * @param allocator ID block allocator, which is used in this class
     */
    public IdBlockAllocatorBasedIntentIdGenerator(IdBlockAllocator allocator) {
        this.allocator = checkNotNull(allocator);
        this.idBlock = allocator.allocateUniqueIdBlock();
    }

    @Override
    public synchronized IntentId getNewId() {
        try {
            return new IntentId(idBlock.getNextId());
        } catch (UnavailableIdException e) {
            idBlock = allocator.allocateUniqueIdBlock();
            return new IntentId(idBlock.getNextId());
        }
    }
}

@@ -656,32 +656,74 @@
 ts a
- %7B@link IdB
+n intent ID generator, which uses the specified ID b
 lock
-A
+ a
 llocator
 Base
@@ -722,31 +722,53 @@
 ator
-BasedIntentIdGenerator%7D
+%0A     * to generate a global unique intent ID
 .%0A  
@@ -796,16 +796,20 @@
 locator 
+the 
 ID block
@@ -822,36 +822,40 @@
 ator
-, which is used in this clas
+ to use for generating intent ID
 s%0A  

Revise Javadoc