Skip to content

Commit 4098dbb

Browse files
committed
Fix to fall back to key based config in binary mode for 1.4.5 engine
1 parent 7029a1e commit 4098dbb

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/main/java/net/spy/memcached/ConfigurationPoller.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ public void run(){
115115
newConfigResponse = (String)client.getConfig(socketAddressToGetConfig,
116116
ConfigurationType.CLUSTER,
117117
configTranscoder);
118+
if(newConfigResponse == null || newConfigResponse.trim().isEmpty()){
119+
newConfigResponse = (String)client.get(socketAddressToGetConfig, ConfigurationType.CLUSTER.getValueWithNameSpace(), configTranscoder);
120+
if(newConfigResponse != null && ! newConfigResponse.trim().isEmpty()){
121+
client.setIsConfigurationProtocolSupported(false);
122+
}
123+
}
124+
118125
}catch(OperationNotSupportedException e){
119126
//Fallback to key based config access.
120127
client.setIsConfigurationProtocolSupported(false);

src/main/java/net/spy/memcached/MemcachedClient.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,21 @@ private void initializeClientUsingConfigEndPoint(ConnectionFactory cf, InetSocke
298298
throws IOException{
299299
configurationNode = new NodeEndPoint(configurationEndPoint.getHostName(), configurationEndPoint.getPort());
300300
setupConnection(cf, Collections.singletonList(configurationEndPoint));
301-
302-
String configResult;
301+
boolean checkKey = false;
302+
String configResult = null;
303303
try{
304304
try{
305305
//GetConfig
306306
configResult = (String)this.getConfig(configurationEndPoint, ConfigurationType.CLUSTER, configTranscoder);
307307
}catch(OperationNotSupportedException e){
308-
308+
checkKey = true;
309+
}
310+
311+
if(checkKey || configResult == null || configResult.trim().isEmpty()){
309312
configResult = (String)this.get(configurationEndPoint, ConfigurationType.CLUSTER.getValueWithNameSpace(), configTranscoder);
310-
isConfigurationProtocolSupported = false;
313+
if(configResult != null && ! configResult.trim().isEmpty()){
314+
isConfigurationProtocolSupported = false;
315+
}
311316
}
312317

313318
if(configResult != null && ! configResult.trim().isEmpty()){

0 commit comments

Comments
 (0)