Skip to content

Commit

Permalink
Add non blocking bounded queue FeedableBodyGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed Dec 7, 2015
1 parent 1ef6d82 commit 4a0d2d7
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -16,15 +16,14 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public final class BlockingQueueFeedableBodyGenerator extends QueueBasedFeedableBodyGenerator<BlockingQueue<BodyChunk>> {
public final class BoundedQueueFeedableBodyGenerator extends QueueBasedFeedableBodyGenerator<BlockingQueue<BodyChunk>> {

public BlockingQueueFeedableBodyGenerator(int capacity) {
public BoundedQueueFeedableBodyGenerator(int capacity) {
super(new ArrayBlockingQueue<>(capacity, true));
}

@Override
protected boolean offer(BodyChunk chunk) throws InterruptedException {
queue.put(chunk);
return true;
return queue.offer(chunk);
}
}

0 comments on commit 4a0d2d7

Please sign in to comment.