Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97A3D17E4C for ; Fri, 13 Feb 2015 03:28:12 +0000 (UTC) Received: (qmail 16649 invoked by uid 500); 13 Feb 2015 03:28:12 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 16463 invoked by uid 500); 13 Feb 2015 03:28:11 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 16382 invoked by uid 99); 13 Feb 2015 03:28:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Feb 2015 03:28:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ED56DE05E2; Fri, 13 Feb 2015 03:28:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Fri, 13 Feb 2015 03:28:17 -0000 Message-Id: <6cdf73d5da1d47d39a242526614c02c3@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Thu Feb 12 19:21:35 2015 -0500 Committer: Josh Elser 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 {