Skip to content

Commit

Permalink
Merge pull request #123 from thelastpickle/fix-endpointtohostid-issue
Browse files Browse the repository at this point in the history
Fix issue with C* <= 2.1.9 not having the StorageServiceMBean.getEndp…
  • Loading branch information
adejanovski authored Jun 21, 2017
2 parents 07887ee + 6f91035 commit cacd6dc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 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 @@ -58,7 +59,7 @@
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;

import com.google.common.collect.Maps;
import com.datastax.driver.core.policies.EC2MultiRegionAddressTranslator;
import com.spotify.reaper.ReaperException;
import com.spotify.reaper.core.Cluster;
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 cacd6dc

Please sign in to comment.