Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorFactory.java b/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorFactory.java
- index e2c1f9c..a6b6bb3 100644
- --- a/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorFactory.java
- +++ b/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorFactory.java
- @@ -130,10 +130,20 @@ public class ClientRequestExecutorFactory implements
- while(!socketChannel.finishConnect()) {
- long diff = finishConnectTimeoutMs - System.currentTimeMillis();
- - if(diff < 0)
- + if(diff < 0) {
- + // Don't forget to close the socket before we throw our
- + // exception or they'll leak :(
- + try {
- + socketChannel.close();
- + } catch(Exception e) {
- + if(logger.isEnabledFor(Level.WARN))
- + logger.warn(e, e);
- + }
- +
- throw new ConnectException("Cannot connect socket " + numCreated + " for "
- + dest.getHost() + ":" + dest.getPort() + " after "
- + connectTimeoutMs + " ms");
- + }
- if(logger.isTraceEnabled())
- logger.trace("Still creating socket " + numCreated + " for " + dest.getHost() + ":"
- @@ -182,10 +192,23 @@ public class ClientRequestExecutorFactory implements
- // Block while we wait for the protocol negotiation to complete.
- clientRequest.await();
- - // This will throw an error if the result of the protocol negotiation
- - // failed, otherwise it returns an uninteresting token we can safely
- - // ignore.
- - clientRequest.getResult();
- + try {
- + // This will throw an error if the result of the protocol
- + // negotiation failed, otherwise it returns an uninteresting token
- + // we can safely ignore.
- + clientRequest.getResult();
- + } catch(Exception e) {
- + // Don't forget to close the socket before we throw our exception or
- + // they'll leak :(
- + try {
- + socketChannel.close();
- + } catch(Exception ex) {
- + if(logger.isEnabledFor(Level.WARN))
- + logger.warn(ex, ex);
- + }
- +
- + throw e;
- + }
- return clientRequestExecutor;
- }
- diff --git a/test/integration/voldemort/performance/benchmark/Benchmark.java b/test/integration/voldemort/performance/benchmark/Benchmark.java
- index 3d21798..eea33c9 100644
- --- a/test/integration/voldemort/performance/benchmark/Benchmark.java
- +++ b/test/integration/voldemort/performance/benchmark/Benchmark.java
- @@ -346,10 +346,11 @@ public class Benchmark {
- ClientConfig clientConfig = new ClientConfig().setMaxThreads(numThreads)
- .setMaxTotalConnections(numThreads)
- .setMaxConnectionsPerNode(numThreads)
- + .setFailureDetectorBannagePeriod(5000)
- .setBootstrapUrls(socketUrl)
- - .setConnectionTimeout(60,
- - TimeUnit.SECONDS)
- - .setSocketTimeout(60, TimeUnit.SECONDS)
- + .setConnectionTimeout(500,
- + TimeUnit.MILLISECONDS)
- + .setSocketTimeout(5, TimeUnit.SECONDS)
- .setFailureDetectorRequestLengthThreshold(TimeUnit.SECONDS.toMillis(60))
- .setSocketBufferSize(socketBufferSize)
- .setSelectors(numSelectors)
Add Comment
Please, Sign In to add comment