net.spy.memcached.ops.ArrayOperationQueueFactory Maven / Gradle / Ivy
The newest version!
package net.spy.memcached.ops;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
/**
* OperationQueueFactory that uses an ArrayBlockingQueue.
*/
public class ArrayOperationQueueFactory implements OperationQueueFactory {
private final int capacity;
/**
* Create an ArrayOperationQueueFactory that creates blocking queues with
* the given capacity.
*
* @param cap maximum size of a queue produced by this factory
*/
public ArrayOperationQueueFactory(int cap) {
super();
capacity = cap;
}
public BlockingQueue create() {
return new ArrayBlockingQueue(capacity);
}
}