Skip to content

Instantly share code, notes, and snippets.

@patricioe
Created October 5, 2011 16:55
Show Gist options
  • Save patricioe/1264997 to your computer and use it in GitHub Desktop.
Save patricioe/1264997 to your computer and use it in GitHub Desktop.
HEctor PR 295 V2
1 diff --git a/core/src/main/java/me/prettyprint/cassandra/connection/NodeAutoDiscoverService.java b/core/src/main/java/me/prettyprint/cassandra/connection/NodeAutoDiscoverService.jav a
2 index bc2e3a3..375d489 100644
3 --- a/core/src/main/java/me/prettyprint/cassandra/connection/NodeAutoDiscoverService.java
4 +++ b/core/src/main/java/me/prettyprint/cassandra/connection/NodeAutoDiscoverService.java
5 @@ -11,6 +11,7 @@ import me.prettyprint.hector.api.Keyspace;
6
7 import org.apache.cassandra.thrift.KsDef;
8 import org.apache.cassandra.thrift.TokenRange;
9 +import org.apache.thrift.transport.TTransportException;
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
12
13 @@ -97,6 +98,9 @@ public class NodeAutoDiscoverService extends BackgroundCassandraHostService {
14 break;
15 }
16 }
17 + } catch (TTransportException e) {
18 + log.error("Discovery Service failed attempt to connect CassandraHost with TransportException", e);
19 + closeClientQuietly(thriftClient);
20 } catch (Exception e) {
21 log.error("Discovery Service failed attempt to connect CassandraHost", e);
22 } finally {
23 @@ -105,5 +109,11 @@ public class NodeAutoDiscoverService extends BackgroundCassandraHostService {
24 return foundHosts;
25 }
26
27 + private void closeClientQuietly(HThriftClient thriftClient) {
28 + if (thriftClient != null) {
29 + thriftClient.close();
30 + }
31 + }
32 +
33 }
34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment