Skip to content

Commit

Permalink
[FLINK-5002] [network] Renamed getNumberOfUsedBuffers() method to bes…
Browse files Browse the repository at this point in the history
…tEffortGetNumOfUsedBuffers()

This closes apache#2865
  • Loading branch information
MayerRoman authored and StephanEwen committed Dec 14, 2016
1 parent 22a8204 commit a5cf88f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ public interface BufferPool extends BufferProvider, BufferRecycler {
/**
* Returns the number of used buffers of this buffer pool.
*/
int getNumberOfUsedBuffers();
int bestEffortGetNumOfUsedBuffers();

}
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public int getNumBuffers() {
}

@Override
public int getNumberOfUsedBuffers() {
return numberOfRequestedMemorySegments - availableMemorySegments.size();
public int bestEffortGetNumOfUsedBuffers() {
return Math.max(0, numberOfRequestedMemorySegments - availableMemorySegments.size());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Float getValue() {
int bufferPoolSize = 0;

for (SingleInputGate inputGate : task.getAllInputGates()) {
usedBuffers += inputGate.getBufferPool().getNumberOfUsedBuffers();
usedBuffers += inputGate.getBufferPool().bestEffortGetNumOfUsedBuffers();
bufferPoolSize += inputGate.getBufferPool().getNumBuffers();
}

Expand Down Expand Up @@ -212,7 +212,7 @@ public Float getValue() {
int bufferPoolSize = 0;

for (ResultPartition resultPartition : task.getProducedPartitions()) {
usedBuffers += resultPartition.getBufferPool().getNumberOfUsedBuffers();
usedBuffers += resultPartition.getBufferPool().bestEffortGetNumOfUsedBuffers();
bufferPoolSize += resultPartition.getBufferPool().getNumBuffers();
}

Expand Down

0 comments on commit a5cf88f

Please sign in to comment.