FileDocCategorySizeDatePackage
UniqueValueBlock.javaAPI DocGlassfish v2 API3131Fri May 04 22:32:08 BST 2007com.sun.enterprise.util

UniqueValueBlock

public class UniqueValueBlock extends Object implements Serializable
Represents a block of unique numbers reserved for a particular context by the backend value generator. This class should only be used internally by concrete UniqueValueGenerator implementations.
author
Kenneth Saks

Fields Summary
private long
start_
private long
extent_
private long
current_
Constructors Summary
UniqueValueBlock(long start, long extent)
Use package-level access since this class should only be used internally by concrete instances of UniqueValueGenerator. The extent value must be >= 1.

        start_   = start;
        extent_  = extent;
        current_ = start;
    
Methods Summary
public synchronized booleanhasNext()

        return (current_ < (start_ + extent_));
    
public synchronized longnext()

        if( !hasNext() ) {
            throw new IllegalStateException();
        }
        long returnValue = current_;
        current_++;
        return returnValue;