docs: public synchronized short allocateId() throws IdAllocatorException
     {
        if (tc.isEntryEnabled()) SibTr.entry(tc, "allocateId");
  
        short nextAllocatedId = NULL_ID;
        
        // First check the last freed id
        if (lastFreeId != NULL_ID)
        {
           nextAllocatedId = lastFreeId;
           lastFreeId = NULL_ID;
        }
        // Is the next Id not null?
        else if (nextId != NULL_ID)
        {
           nextAllocatedId = nextId;
           if (nextId == maxId)
           {
              nextId = NULL_ID;
           }
           else
           {
              nextId++;
           }
        }
        // Otherwise check all the possible ids for a free one
        else
        {
           for (short x = 0; x < allocMap.length; x++)
           {
              byte oneByte = allocMap[x];
              
              // Get the first byte. If all the bits are set, then don't worry about it
              if (oneByte != (byte) 0xFF)
              {
                 // Otherwise check each one to find out what id is free
                 if ((oneByte & 0x80) == 0)
                 {
                    // Bit 1 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 1);
                }
                 else if ((oneByte & 0x40) == 0)
                 {
                    // Bit 2 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 2);
                 }
                 else if ((oneByte & 0x20) == 0)
                 {
                    // Bit 3 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 3);
                 }
                 else if ((oneByte & 0x10) == 0)
                 {
                    // Bit 4 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 4);
                 }
                 else if ((oneByte & 0x8) == 0)
                 {
                    // Bit 5 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 5);
                 }
                 else if ((oneByte & 0x4) == 0)
                 {
                    // Bit 6 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 6);
                 }
                 else if ((oneByte & 0x2) == 0)
                 {
                    // Bit 7 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 7);
                 }
                 else if ((oneByte & 0x1) == 0)
                 {
                    // Bit 8 is not set
                    nextAllocatedId = (short) (((x + 1) * 8) - 8);
                    
                    // Are we allowed zero?
                    if (nextAllocatedId == 0 && !allowZero)
                    {
                       nextAllocatedId = NULL_ID;
                    }
                 }
              }
  
              else if (nextAllocatedId != NULL_ID) 
              {
                 break;
              }
           }
        }
        
        // If we found nothing, then we have no choice but to throw an exception
        if (nextAllocatedId == NULL_ID)
        {
           throw new IdAllocatorException();
        }
        else
        {
           allocate(nextAllocatedId);
        }
  
        if (tc.isEntryEnabled()) SibTr.exit(tc, "allocateId", ""+nextId);
        return nextAllocatedId;
     }