Skip to content

Commit

Permalink
Merge pull request #15 from nerdynick/ConnectTimeout
Browse files Browse the repository at this point in the history
Added support for connect timeout setting via XMemcachedClientFactoryBean
  • Loading branch information
killme2008 committed Oct 2, 2013
2 parents 1277861 + 893658e commit 0df8597
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ public MemcachedClient build() throws IOException {
if (this.commandFactory.getProtocol() == Protocol.Kestrel) {
memcachedClient.setOptimizeGet(false);
}
memcachedClient.setConnectTimeout(connectTimeout);
memcachedClient.setSanitizeKeys(sanitizeKeys);
memcachedClient.setKeyProvider(this.keyProvider);
memcachedClient.setOpTimeout(this.opTimeout);
memcachedClient.setOpTimeout(this.opTimeout);
memcachedClient.setHealSessionInterval(this.healSessionInterval);
memcachedClient.setEnableHealSession(this.enableHealSession);
memcachedClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public class XMemcachedClientFactoryBean implements FactoryBean {
private boolean failureMode;

private long opTimeout = MemcachedClient.DEFAULT_OP_TIMEOUT;

private long connectTimeout = MemcachedClient.DEFAULT_CONNECT_TIMEOUT;

private KeyProvider keyProvider = DefaultKeyProvider.INSTANCE;

Expand Down Expand Up @@ -263,6 +265,8 @@ private void configBuilder(MemcachedClientBuilder builder) {
builder.setName(this.name);
builder.setEnableHealSession(this.enableHealSession);
builder.setHealSessionInterval(this.healSessionInterval);
builder.setConnectTimeout(connectTimeout);
builder.setOpTimeout(opTimeout);
}

private int[] getWeightsArray(
Expand Down Expand Up @@ -315,7 +319,7 @@ public void shutdown() throws IOException {
}
}

@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Class getObjectType() {
return MemcachedClient.class;
}
Expand All @@ -324,4 +328,12 @@ public boolean isSingleton() {
return true;
}

public long getConnectTimeout() {
return connectTimeout;
}

public void setConnectTimeout(long connectTimeout) {
this.connectTimeout = connectTimeout;
}

}

0 comments on commit 0df8597

Please sign in to comment.