docs: private int tryReserveEventSizeAndLock(long state, int size)
    {
      Preconditions.checkArgument(size > 0);
      int bufferWatermark = bufferWatermark(state);
      while (true) {
        if (compareAndSetState(state, state + size + PARTY)) {
          return bufferWatermark;
        }
        state = getState();
        if (isSealed(state)) {
          return -1;
        }
        bufferWatermark = bufferWatermark(state);
        int newBufferWatermark = bufferWatermark + size;
        Preconditions.checkState(newBufferWatermark > 0);
        if (newBufferWatermark > emitter.maxBufferWatermark) {
          return -1;
        }
      }
    }