/** * Assign the exclusive buffers to all remote input channels directly for credit-based mode. */ @VisibleForTesting public void assignExclusiveSegments() throws IOException { checkState(this.isCreditBased, "Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control."); checkState(this.networkBufferPool != null, "Bug in input gate setup logic: global buffer pool has" + "not been set for this input gate."); synchronized (requestLock) { for (InputChannel inputChannel : inputChannels.values()) { if (inputChannel instanceof RemoteInputChannel) { ((RemoteInputChannel) inputChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel)); } } } } }
/** * Assign the exclusive buffers to all remote input channels directly for credit-based mode. * * @param networkBufferPool The global pool to request and recycle exclusive buffers * @param networkBuffersPerChannel The number of exclusive buffers for each channel */ public void assignExclusiveSegments(NetworkBufferPool networkBufferPool, int networkBuffersPerChannel) throws IOException { checkState(this.isCreditBased, "Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control."); checkState(this.networkBufferPool == null, "Bug in input gate setup logic: global buffer pool has" + "already been set for this input gate."); this.networkBufferPool = checkNotNull(networkBufferPool); this.networkBuffersPerChannel = networkBuffersPerChannel; synchronized (requestLock) { for (InputChannel inputChannel : inputChannels.values()) { if (inputChannel instanceof RemoteInputChannel) { ((RemoteInputChannel) inputChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel)); } } } }
/** * Assign the exclusive buffers to all remote input channels directly for credit-based mode. * * @param networkBufferPool The global pool to request and recycle exclusive buffers * @param networkBuffersPerChannel The number of exclusive buffers for each channel */ public void assignExclusiveSegments(NetworkBufferPool networkBufferPool, int networkBuffersPerChannel) throws IOException { checkState(this.isCreditBased, "Bug in input gate setup logic: exclusive buffers only exist with credit-based flow control."); checkState(this.networkBufferPool == null, "Bug in input gate setup logic: global buffer pool has" + "already been set for this input gate."); this.networkBufferPool = checkNotNull(networkBufferPool); this.networkBuffersPerChannel = networkBuffersPerChannel; synchronized (requestLock) { for (InputChannel inputChannel : inputChannels.values()) { if (inputChannel instanceof RemoteInputChannel) { ((RemoteInputChannel) inputChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel)); } } } }
/** * Assign the exclusive buffers to one remote input channels directly for credit-based mode. * * @param inputChannel The channel to assign exclusive buffers to */ public void assignExclusiveSegments(InputChannel inputChannel) throws IOException { Preconditions.checkNotNull(inputChannel); Preconditions.checkArgument(inputChannel instanceof RemoteInputChannel, "InputChannel should be remote input channel only."); checkState(this.networkBufferPool != null, "Bug in input gate setup logic: global buffer pool has " + "not been set for this input gate."); if (isCreditBased) { ((RemoteInputChannel) inputChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel)); } }
"global buffer pool has not been set for this input gate."); ((RemoteInputChannel) newChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel));
"global buffer pool has not been set for this input gate."); ((RemoteInputChannel) newChannel).assignExclusiveSegments( networkBufferPool.requestMemorySegments(networkBuffersPerChannel));