public long nextUniqueID() {
        final Lock lock = sequenceBlocks.getLock(type);
        lock.lock();
        try {
            Data data = sequenceBlocks.get(type);
            if (data == null || !(data.getCurrentID() < data.getMaxID())) {
                data = getNextBlock();
            }

            final long id = data.getCurrentID();
            data.setCurrentID(id + 1);
            sequenceBlocks.put(type, data);
            return id;
        } finally {
            lock.unlock();
        }
    }
Returns the next available unique ID. Essentially this provides for the functionality of an
auto-increment database field.
@return the next sequence number
xmppserver/src/main/java/org/jivesoftware/database/SequenceManager.java