未验证 提交 b8e5ff51 编写于 作者: 李文广 提交者: GitHub

Remove Buffer redundant strategy judgment code. (#5277)

上级 b0bb7cf3
......@@ -35,22 +35,16 @@ public class Buffer<T> implements QueueBuffer<T> {
index = new AtomicRangeInteger(0, bufferSize);
}
@Override
public void setStrategy(BufferStrategy strategy) {
this.strategy = strategy;
}
@Override
public boolean save(T data) {
int i = index.getAndIncrement();
if (buffer[i] != null) {
switch (strategy) {
case BLOCKING:
while (buffer[i] != null) {
try {
Thread.sleep(1L);
} catch (InterruptedException e) {
}
}
break;
case IF_POSSIBLE:
return false;
default:
......@@ -60,10 +54,12 @@ public class Buffer<T> implements QueueBuffer<T> {
return true;
}
@Override
public int getBufferSize() {
return buffer.length;
}
@Override
public void obtain(List<T> consumeList) {
this.obtain(consumeList, 0, buffer.length);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册