Skip to content

Don't blindly ignore the operation queue max block time parameter in Ket... #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/main/java/net/spy/memcached/DefaultConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public class DefaultConnectionFactory extends SpyObject implements

protected final int opQueueLen;
private final int readBufSize;
private final long opQueueMaxBlockTime;
private final HashAlgorithm hashAlg;

private MetricCollector metrics;
Expand All @@ -130,6 +131,15 @@ public class DefaultConnectionFactory extends SpyObject implements
*/
private ExecutorService executorService;


public DefaultConnectionFactory(int qLen, int bufSize, long opQMaxBlockTime, HashAlgorithm hash) {
super();
opQueueLen = qLen;
readBufSize = bufSize;
opQueueMaxBlockTime = opQMaxBlockTime;
hashAlg = hash;
metrics = null;
}
/**
* Construct a DefaultConnectionFactory with the given parameters.
*
Expand All @@ -138,11 +148,7 @@ public class DefaultConnectionFactory extends SpyObject implements
* @param hash the algorithm to use for hashing
*/
public DefaultConnectionFactory(int qLen, int bufSize, HashAlgorithm hash) {
super();
opQueueLen = qLen;
readBufSize = bufSize;
hashAlg = hash;
metrics = null;
this(qLen, bufSize, DEFAULT_OP_QUEUE_MAX_BLOCK_TIME, hash);
}

/**
Expand Down Expand Up @@ -256,7 +262,7 @@ public int getOpQueueLen() {
* complete, in milliseconds, or null for no waiting.
*/
public long getOpQueueMaxBlockTime() {
return DEFAULT_OP_QUEUE_MAX_BLOCK_TIME;
return opQueueMaxBlockTime;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class KetamaConnectionFactory extends DefaultConnectionFactory {
*/
public KetamaConnectionFactory(int qLen, int bufSize,
long opQueueMaxBlockTime) {
super(qLen, bufSize, DefaultHashAlgorithm.KETAMA_HASH);
super(qLen, bufSize, opQueueMaxBlockTime, DefaultHashAlgorithm.KETAMA_HASH);
}

/**
Expand Down