You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/02/13 04:28:17 UTC

[8/9] accumulo git commit: Merge branch '1.6'

Merge branch '1.6'

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3d3bfe68
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3d3bfe68
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3d3bfe68

Branch: refs/heads/master
Commit: 3d3bfe684efc20d7ef5b325ed6b6d369c887dd89
Parents: b8a1b31 1213ee2
Author: Josh Elser <el...@apache.org>
Authored: Thu Feb 12 19:21:35 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Feb 12 19:21:35 2015 -0500

----------------------------------------------------------------------
 .../core/client/impl/ThriftTransportKey.java    |   7 +-
 .../core/client/impl/ThriftTransportPool.java   |   6 +-
 .../accumulo/test/TransportCachingIT.java       | 115 +++++++++++++++++++
 3 files changed, 124 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3d3bfe68/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java
index 072724b,8e3ee47..a843111
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java
@@@ -16,48 -16,40 +16,51 @@@
   */
  package org.apache.accumulo.core.client.impl;
  
 -import org.apache.accumulo.core.util.ArgumentChecker;
 -import org.apache.accumulo.core.util.SslConnectionParams;
 +import static com.google.common.base.Preconditions.checkNotNull;
 +
 +import org.apache.accumulo.core.rpc.SaslConnectionParams;
 +import org.apache.accumulo.core.rpc.SslConnectionParams;
  
+ import com.google.common.annotations.VisibleForTesting;
 +import com.google.common.net.HostAndPort;
  
- class ThriftTransportKey {
+ @VisibleForTesting
+ public class ThriftTransportKey {
 -  private final String location;
 -  private final int port;
 +  private final HostAndPort server;
    private final long timeout;
    private final SslConnectionParams sslParams;
 +  private final SaslConnectionParams saslParams;
  
    private int hash = -1;
  
-   ThriftTransportKey(HostAndPort server, long timeout, ClientContext context) {
+   @VisibleForTesting
 -  public ThriftTransportKey(String location, long timeout, SslConnectionParams sslParams) {
 -    ArgumentChecker.notNull(location);
 -    String[] locationAndPort = location.split(":", 2);
 -    if (locationAndPort.length == 2) {
 -      this.location = locationAndPort[0];
 -      this.port = Integer.parseInt(locationAndPort[1]);
 -    } else
 -      throw new IllegalArgumentException("Location was expected to contain port but did not. location=" + location);
 -
++  public ThriftTransportKey(HostAndPort server, long timeout, ClientContext context) {
 +    checkNotNull(server, "location is null");
 +    this.server = server;
      this.timeout = timeout;
 -    this.sslParams = sslParams;
 +    this.sslParams = context.getClientSslParams();
 +    this.saslParams = context.getClientSaslParams();
 +    if (null != saslParams) {
 +      // TSasl and TSSL transport factories don't play nicely together
 +      if (null != sslParams) {
 +        throw new RuntimeException("Cannot use both SSL and SASL thrift transports");
 +      }
 +    }
    }
  
 -  String getLocation() {
 -    return location;
 +  /**
 +   * Visible only for testing
 +   */
 +  ThriftTransportKey(HostAndPort server, long timeout, SslConnectionParams sslParams, SaslConnectionParams saslParams) {
 +    checkNotNull(server, "location is null");
 +    this.server = server;
 +    this.timeout = timeout;
 +    this.sslParams = sslParams;
 +    this.saslParams = saslParams;
    }
  
 -  int getPort() {
 -    return port;
 +  HostAndPort getServer() {
 +    return server;
    }
  
    long getTimeout() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/3d3bfe68/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
index bc1cdbb,33997e0..730fd73
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
@@@ -31,14 -31,17 +31,15 @@@ import java.util.Set
  import java.util.concurrent.CountDownLatch;
  import java.util.concurrent.atomic.AtomicBoolean;
  
 -import org.apache.accumulo.core.conf.AccumuloConfiguration;
 -import org.apache.accumulo.core.conf.Property;
 +import org.apache.accumulo.core.rpc.ThriftUtil;
  import org.apache.accumulo.core.util.Daemon;
  import org.apache.accumulo.core.util.Pair;
 -import org.apache.accumulo.core.util.SslConnectionParams;
 -import org.apache.accumulo.core.util.ThriftUtil;
 -import org.apache.log4j.Logger;
  import org.apache.thrift.transport.TTransport;
  import org.apache.thrift.transport.TTransportException;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
  
+ import com.google.common.annotations.VisibleForTesting;
  import com.google.common.net.HostAndPort;
  
  public class ThriftTransportPool {