Skip to content
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

Fix ignoring opQueueMaxBlockTime in KetamaConnectionFactory #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions src/main/java/net/spy/memcached/KetamaConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
public class KetamaConnectionFactory extends DefaultConnectionFactory {

private final KetamaNodeKeyFormatter.Format ketamaNodeKeyFormat;
private Map<InetSocketAddress, Integer> weights;
private final Map<InetSocketAddress, Integer> weights;
private final long opQueueMaxBlockTime;

/**
* Create a KetamaConnectionFactory with the given maximum operation
Expand All @@ -53,7 +54,7 @@ public class KetamaConnectionFactory extends DefaultConnectionFactory {
* @param opQueueMaxBlockTime the maximum time to block waiting for op
* queue operations to complete, in milliseconds
*/
public KetamaConnectionFactory(int qLen, int bufSize,
public KetamaConnectionFactory(int qLen, int bufSize,
long opQueueMaxBlockTime) {
this(qLen, bufSize, opQueueMaxBlockTime,
DefaultHashAlgorithm.KETAMA_HASH,
Expand All @@ -77,6 +78,7 @@ public KetamaConnectionFactory(
super(qLen, bufSize, hash);
this.ketamaNodeKeyFormat = nodeKeyFormat;
this.weights = weights;
this.opQueueMaxBlockTime = opQueueMaxBlockTime;
}

/**
Expand All @@ -96,9 +98,14 @@ public KetamaConnectionFactory() {
public NodeLocator createLocator(List<MemcachedNode> nodes) {
return new KetamaNodeLocator(nodes, getHashAlg(),
getKetamaNodeKeyFormat(), getWeights());
}
}

/**
@Override
public long getOpQueueMaxBlockTime() {
return opQueueMaxBlockTime;
}

/**
* @return the ketamaNodeKeyFormat
*/
public KetamaNodeKeyFormatter.Format getKetamaNodeKeyFormat() {
Expand Down