public int allocate(final String label, final int typeId)
    {
        final int counterId = nextCounterId();
        checkCountersCapacity(counterId);

        final int recordOffset = metaDataOffset(counterId);
        checkMetaDataCapacity(recordOffset);

        try
        {
            metaDataBuffer.putInt(recordOffset + TYPE_ID_OFFSET, typeId);
            metaDataBuffer.putLong(recordOffset + FREE_FOR_REUSE_DEADLINE_OFFSET, NOT_FREE_TO_REUSE);
            putLabel(recordOffset, label);

            metaDataBuffer.putIntOrdered(recordOffset, RECORD_ALLOCATED);
        }
        catch (final Exception ex)
        {
            freeList.pushInt(counterId);
            LangUtil.rethrowUnchecked(ex);
        }

        return counterId;
    }
public int allocate ( final String label , final int typeId ) { final int counterId = nextCounterId ( ) ; checkCountersCapacity ( counterId ) ; final int recordOffset = metaDataOffset ( counterId ) ; checkMetaDataCapacity ( recordOffset ) ; try { metaDataBuffer . putInt ( recordOffset + TYPE_ID_OFFSET , typeId ) ; metaDataBuffer . putLong ( recordOffset + FREE_FOR_REUSE_DEADLINE_OFFSET , NOT_FREE_TO_REUSE ) ; putLabel ( recordOffset , label ) ; metaDataBuffer . putIntOrdered ( recordOffset , RECORD_ALLOCATED ) ; } catch ( final Exception ex ) { freeList . pushInt ( counterId ) ; LangUtil . rethrowUnchecked ( ex ) ; } return counterId ; }
Allocate a new counter with a given label and type.

@param label  to describe the counter.
@param typeId for the type of counter.
@return the id allocated for the counter.