Skip to content

Commit

Permalink
Fix issue with C* <= 2.1.9 not having the StorageServiceMBean.getEndp…
Browse files Browse the repository at this point in the history
…ointToHostId() method
  • Loading branch information
adejanovski committed Jun 21, 2017
1 parent 07887ee commit d0fff6c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/spotify/reaper/cassandra/JmxProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -252,9 +253,12 @@ public List<String> tokenRangeToEndpoint(String keyspace, RingRange tokenRange)
@NotNull
public Map<String, String> getEndpointToHostId() {
checkNotNull(ssProxy, "Looks like the proxy is not connected");
Map<String, String> hosts =
((StorageServiceMBean) ssProxy).getEndpointToHostId();

Map<String, String> hosts = Maps.newHashMap();
try{
hosts = ((StorageServiceMBean) ssProxy).getEndpointToHostId();
} catch(UndeclaredThrowableException e){
hosts = ((StorageServiceMBean) ssProxy).getHostIdMap();
}
return hosts;
}

Expand Down

0 comments on commit d0fff6c

Please sign in to comment.