{@inheritDoc}

Being a Mutation. This method will block if either of the following are true:
1) There are more than {@code maxInflightRpcs} RPCs in flight
2) There are more than {@link #getWriteBufferSize()} bytes pending
193871
@Override
  public void mutate(Mutation mutation) throws IOException {
    handleExceptions();
    addCallback(helper.mutate(mutation), mutation);
  }
1310737
private BlockingQueue<ConsumerRecord<String, byte[]>> _getBuffer(String topic) {
        BlockingQueue<ConsumerRecord<String, byte[]>> buffer = topicBuffers.get(topic);
        if (buffer == null) {
            buffer = new LinkedBlockingQueue<ConsumerRecord<String, byte[]>>();
            BlockingQueue<ConsumerRecord<String, byte[]>> existingBuffer = topicBuffers
                    .putIfAbsent(topic, buffer);
            if (existingBuffer != null) {
                buffer = existingBuffer;
            }
        }
        return buffer;
    }
504099
@Override
	public Buffer requestBuffer(int minBufferSize) throws IOException {
		try {
			return requestBuffer(minBufferSize, false);
		} catch (InterruptedException e) {
			throw new IOException("Unexpected InterruptedException while non-blocking buffer request.");
		}
	}
1164565
function() {
    if (this.buffers.length) {
      var last = this.buffers[this.buffers.length - 1];
      if (!last.full) {
        return last;
      }
    }
    var buf = new ReadWriteBuf(this.bufSize);
    this.buffers.push(buf);
    return buf;
  }
799622
@Override
  public MtasSpanQuery rewrite(IndexReader reader) throws IOException {
    MtasSpanQuery newQ1 = (MtasSpanQuery) q1.rewrite(reader);
    MtasSpanQuery newQ2 = (MtasSpanQuery) q2.rewrite(reader);
    if (newQ1 == null || newQ1 instanceof MtasSpanMatchNoneQuery
        || newQ2 == null || newQ2 instanceof MtasSpanMatchNoneQuery) {
      return new MtasSpanMatchNoneQuery(field);
    } else if (!newQ1.equals(q1) || !newQ2.equals(q2)) {
      return new MtasSpanFullyAlignedWithQuery(newQ1, newQ2).rewrite(reader);
    } else if (newQ1.equals(newQ2)) {
      return newQ1;
    } else {
      boolean returnNone;
      returnNone = newQ1.getMaximumWidth() != null
          && newQ1.getMaximumWidth() == 0;
      returnNone |= newQ2.getMaximumWidth() != null
          && newQ2.getMaximumWidth() == 0;
      returnNone |= newQ1.getMinimumWidth() != null
          && newQ2.getMaximumWidth() != null
          && newQ1.getMinimumWidth() > newQ2.getMaximumWidth();
      returnNone |= newQ2.getMinimumWidth() != null
          && newQ1.getMaximumWidth() != null
          && newQ2.getMinimumWidth() > newQ1.getMaximumWidth();
      returnNone |= newQ2.getMinimumWidth() != null
          && newQ1.getMaximumWidth() != null
          && newQ2.getMinimumWidth() > newQ1.getMaximumWidth();
      if (returnNone) {
        return new MtasSpanMatchNoneQuery(this.getField());
      } else {
        return super.rewrite(reader);
      }
    }
  }
337194
private AFTPClient actionExists() throws PageException, IOException {
	required("item", item);

	AFTPClient client = getClient();
	FTPFile file = existsFile(client, item, false);
	Struct cfftp = writeCfftp(client);

	cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null));
	cfftp.setEL(SUCCEEDED, Boolean.TRUE);

	return client;
    }
36490
@Override
    public int write(SegmentIndexBuffer sib, File sibFile) throws IOException {
        create(sibFile);
        
        RandomAccessFile raf = new RandomAccessFile(sibFile, "rw");
        FileChannel channel = raf.getChannel();
        
        writeVersion(channel);
        int length = sib.write(channel);
        length += STORAGE_VERSION_LENGTH;
        
        raf.setLength(length);
        channel.force(true);
        channel.close();
        raf.close();
        
        if(_logger.isTraceEnabled()) {
            _logger.trace("write " + sibFile.getAbsolutePath());
        }
        
        return length;
    }
942777
@Override
  @InService(PageServiceImpl.class)
  void writeImpl(TableKelp table,
                 PageServiceImpl pageServiceImpl,
                 TableWriterService readWrite,
                 SegmentStream sOut,
                 long oldSequence,
                 int saveLength,
                 int saveTail)
  {
    Objects.requireNonNull(sOut);
    
    // System.out.println("WIMPL:" + this + " "+ Long.toHexString(System.identityHashCode(this)) + " " + _stub);
    if (saveLength <= 0
        || oldSequence != sOut.getSequence()
        || _stub == null
        || ! _stub.allowDelta()) {
      PageLeafImpl newPage;
      
      if (! isDirty() 
          && (_blocks.length == 0 || _blocks[0].isCompact())) {
        newPage = copy(getSequence());
      }
      else {
        newPage = compact(table);
      }

      int sequenceWrite = newPage.nextWriteSequence();

      if (! pageServiceImpl.compareAndSetLeaf(this, newPage)
          && ! pageServiceImpl.compareAndSetLeaf(_stub, newPage)) {
        System.out.println("HMPH: " + pageServiceImpl.getPage(getId()) + " " + this + " " + _stub);
      }
      
      saveLength = newPage.getDataLengthWritten();
      
      // newPage.write(db, pageActor, sOut, saveLength);
      
      // oldSequence = newPage.getSequence();
      
      saveTail = newPage.getSaveTail();
      
      newPage.clearDirty();

      readWrite.writePage(newPage, sOut,
                          oldSequence, saveLength, saveTail,
                          sequenceWrite,
                          Result.of(x->newPage.afterDataFlush(pageServiceImpl, sequenceWrite)));
    }
    else {
      int sequenceWrite = nextWriteSequence();
      
      clearDirty();
      
      readWrite.writePage(this, sOut,
                          oldSequence, saveLength, saveTail,
                          sequenceWrite,
                          Result.of(x->afterDataFlush(pageServiceImpl, sequenceWrite)));
    }
  }
973096
@Override
  public int write(ByteBuffer src) {
    int toTransfer = Math.min(src.remaining(), data.length - offset);
    src.get(data, offset, toTransfer);
    offset += toTransfer;
    return toTransfer;
  }
425627
@Override
    public void setBufferSize(int size) {
        if (this.writing || isClosed()) {
            throw new IllegalStateException("Stream unable to set size");
        }
        this.amountToBuffer = size;
        this.bbSize = (49152 < size) ? 32768 : 8192;

        // make sure we never create larger frames than the max http2 frame size
        Integer h2size = (Integer) this.getVc().getStateMap().get("h2_frame_size");
        if (h2size != null && h2size < bbSize) {
            this.bbSize = h2size;
        }

        int numBuffers = (size / this.bbSize);
        if (0 == size || 0 != (size % this.bbSize)) {
            numBuffers++;
        }
        this.output = new WsByteBuffer[numBuffers];
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setBufferSize=" + size + "; " + this);
        }
    }
695697
@SuppressWarnings("synthetic-access")
    public void executeRpc(RequestBuilder requestBuilder) {

        final RequestCallback callback = requestBuilder.getCallback();
        RequestCallback callbackWrapper = new RequestCallback() {

            public void onError(com.google.gwt.http.client.Request request, Throwable exception) {

                m_requestCounter.decrement();
                callback.onError(request, exception);
            }

            public void onResponseReceived(
                com.google.gwt.http.client.Request request,
                com.google.gwt.http.client.Response response) {

                m_requestCounter.decrement();
                callback.onResponseReceived(request, response);
            }
        };
        requestBuilder.setCallback(callbackWrapper);
        m_requestCounter.increment();
        try {
            requestBuilder.send();
        } catch (Exception e) {
            m_requestCounter.decrement();
        }
    }
937028
@Override
    public WsByteBuffer buildFrameForWrite() {

        WsByteBuffer[] output = buildFrameArrayForWrite();
        int size = 0;
        for (WsByteBuffer b : output) {
            if (b != null) {
                size += b.remaining();
            }
        }
        WsByteBuffer singleBuffer = this.getBuffer(size);
        singleBuffer.put(output);
        singleBuffer.flip();
        return singleBuffer;
    }
538473
private boolean checkMultiReadBuffer() throws IOException {
        //first check existing buffer
        if (null != this.buffer) {
            if (this.buffer.hasRemaining()) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "checkMultiReadBuffer, remaining ->" + this);
                }
                return true;
            }
            if (firstReadCompleteforMulti) { // multiRead enabled and subsequent read
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "checkMultiReadBuffer, buffer is completely read, ready this buffer for the subsequent read ->" + this);
                }
                postDataBuffer.get(postDataIndex).flip(); // make position 0 , to read it again from start
                postDataIndex++;
            } else {
                this.buffer.release();
            }
            this.buffer = null;
        }
        // no buffer read from store or first read of buffer
        if (firstReadCompleteforMulti) {
            // first read from what we have stored, if need more than go to channel
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "checkMultiReadBuffer ,index ->" + postDataIndex + " ,storage.size ->" + postDataBuffer.size());
            }
            if (postDataBuffer.size() <= postDataIndex) {
                //get remaining from channel now as read needs more than the stored
                readRemainingFromChannel();
            }
            if (postDataBuffer.size() > postDataIndex) {
                this.buffer = postDataBuffer.get(postDataIndex);
            }

            if (null != this.buffer) {
                // record the new amount of data read from the store
                this.bytesReadFromStore += this.buffer.remaining();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "checkMultiReadBuffer ->" + this);
                }
                return true;
            }
        } else { // multiRead enabled and first read
            if (getBufferFromChannel()) {
                // store the channel buffer
                postDataBuffer.add(postDataIndex, this.buffer.duplicate());
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "checkMultiReadBuffer, buffer ->" + postDataBuffer.get(postDataIndex)
                                 + " ,buffersize ->" + postDataBuffer.size() + " ,index ->" + postDataIndex);
                }
                postDataIndex++;

                // record the new amount of data read from the channel
                this.bytesRead += this.buffer.remaining();
                return true;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "checkMultiReadBuffer:  no more buffer ->" + this);
        }
        return false;
    }
417944
@Override
    public void write(RtpPacket packet, RTPFormat format) {
        // checking format
        if (format == null) {
            if (logger.isTraceEnabled()) {
                logger.trace("No format specified. Packet dropped!");
            }
            return;
        }

        boolean locked = false;
        try {
            locked = this.lock.tryLock() || this.lock.tryLock(5, TimeUnit.MILLISECONDS);
            if (locked) {
                safeWrite(packet, format);
            }
        } catch (InterruptedException e) {
            if (logger.isTraceEnabled()) {
                logger.trace("Could not aquire write lock for jitter buffer. Dropped packet.");
            }
        } finally {
            if (locked) {
                this.lock.unlock();
            }
        }
    }
1022839
static int encodedBufferSize(int len, boolean breakLines) {
        // Cast len to long to prevent overflow
        long len43 = ((long) len << 2) / 3;

        // Account for padding
        long ret = (len43 + 3) & ~3;

        if (breakLines) {
            ret += len43 / MAX_LINE_LENGTH;
        }

        return ret < Integer.MAX_VALUE ? (int) ret : Integer.MAX_VALUE;
    }
1090887
@Override
    public WsByteBuffer allocateFileChannelBuffer(FileChannel fc) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "allocateFileChannelBuffer");
        }
        return new FCWsByteBufferImpl(fc);
    }
64061
boolean incrementRequestCount( HttpServletRequest request, HttpServletResponse response,
                                   ServletContext servletContext )
        throws IOException
    {
        //
        // First cache the max-concurrent-request-count value.
        //
        if ( _maxConcurrentRequestCount == -1 )
        {
            _maxConcurrentRequestCount = DEFAULT_MAX_CONCURRENT_REQUEST_COUNT;
            assert servletContext != null;

            String countStr = servletContext.getInitParameter( MAX_CONCURRENT_REQUESTS_PARAM );
            if ( countStr != null )
            {
                try
                {
                    _maxConcurrentRequestCount = Integer.parseInt( countStr );
                }
                catch ( NumberFormatException e )
                {
                    _log.error( "Invalid value for servlet context parameter" + MAX_CONCURRENT_REQUESTS_PARAM
                                + ": " + countStr, e );
                }

                if ( _maxConcurrentRequestCount < 1 )
                {
                    _maxConcurrentRequestCount = DEFAULT_MAX_CONCURRENT_REQUEST_COUNT;
                    _log.error( "Invalid value for servlet context parameter" + MAX_CONCURRENT_REQUESTS_PARAM
                                + ": " + countStr );
                }
            }
        }

        //
        // Now, if the current count of concurrent requests to this instance is greater than the max,
        // send an error on the response.
        //
        if ( _requestCount >= _maxConcurrentRequestCount )
        {
            if ( _log.isInfoEnabled() )
            {
                _log.info( "Too many requests to FlowController " + getDisplayName() + " ("
                           + ( _requestCount + 1 ) + '>' + _maxConcurrentRequestCount + "); returning error code "
                           + EXCEEDED_MAX_CONCURRENT_REQUESTS_ERRORCODE );
            }

            response.sendError( EXCEEDED_MAX_CONCURRENT_REQUESTS_ERRORCODE );
            return false;
        }

        //
        // We're ok -- increment the count and continue.
        //
        ++_requestCount;
        return true;
    }