code: public int register(String key) {
          Integer id = store.get(key);
          if (id != null) {
              return id;
          }
  
          int localId = nextId.getAndIncrement();
  
          while (localId < maxId) {
              if (store.setIfAbsent(key, localId)) {
                  return localId;
              }
  
              Integer storeId = store.get(key);
              if (storeId != null) {
                  return storeId;
              }
  
              localId = nextId.getAndIncrement();
          }
  
          throw new IllegalStateException("StringMap id space exhausted");
      }
docs: Registers a key with the map and returns the matching id.
  
  The id corresponding to a key will be consistent if registered more than once, including over restarts, subject to the persistence of the store.
  
  @param key the key to be added
  @return returns the local id, or 0 on failure