accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [08/10] accumulo git commit: ACCUMULO-3199 Internal refactor to add ClientContext
Date Tue, 25 Nov 2014 22:36:52 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index 0cb9f7f..cd3dfd0 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
@@ -43,8 +43,6 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
 import org.apache.accumulo.core.client.TimedOutException;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Column;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -57,11 +55,10 @@ import org.apache.accumulo.core.data.thrift.TKeyValue;
 import org.apache.accumulo.core.data.thrift.TRange;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
-import org.apache.accumulo.core.trace.wrappers.TraceRunnable;
 import org.apache.accumulo.core.trace.Tracer;
+import org.apache.accumulo.core.trace.wrappers.TraceRunnable;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.ThriftUtil;
@@ -77,8 +74,8 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
   
   private static final Logger log = Logger.getLogger(TabletServerBatchReaderIterator.class);
   
+  private final ClientContext context;
   private final Instance instance;
-  private final Credentials credentials;
   private final String table;
   private Authorizations authorizations = Authorizations.EMPTY;
   private final int numThreads;
@@ -105,11 +102,11 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
     void receive(List<Entry<Key,Value>> entries);
   }
   
-  public TabletServerBatchReaderIterator(Instance instance, Credentials credentials, String table, Authorizations authorizations, ArrayList<Range> ranges,
-      int numThreads, ExecutorService queryThreadPool, ScannerOptions scannerOptions, long timeout) {
+  public TabletServerBatchReaderIterator(ClientContext context, String table, Authorizations authorizations, ArrayList<Range> ranges, int numThreads,
+      ExecutorService queryThreadPool, ScannerOptions scannerOptions, long timeout) {
     
-    this.instance = instance;
-    this.credentials = credentials;
+    this.context = context;
+    this.instance = context.getInstance();
     this.table = table;
     this.authorizations = authorizations;
     this.numThreads = numThreads;
@@ -117,7 +114,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
     this.options = new ScannerOptions(scannerOptions);
     resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads);
     
-    this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(instance, new Text(table)), timeout);
+    this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(context, new Text(table)), timeout);
     
     timeoutTrackers = Collections.synchronizedMap(new HashMap<String,TabletServerBatchReaderIterator.TimeoutTracker>());
     timedoutServers = Collections.synchronizedSet(new HashSet<String>());
@@ -227,7 +224,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
     while (true) {
       
       binnedRanges.clear();
-      List<Range> failures = tabletLocator.binRanges(credentials, ranges, binnedRanges);
+      List<Range> failures = tabletLocator.binRanges(context, ranges, binnedRanges);
       
       if (failures.size() > 0) {
         // tried to only do table state checks when failures.size() == ranges.size(), however this did
@@ -343,8 +340,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
           timeoutTracker = new TimeoutTracker(tsLocation, timedoutServers, timeout);
           timeoutTrackers.put(tsLocation, timeoutTracker);
         }
-        doLookup(instance, credentials, tsLocation, tabletsRanges, tsFailures, unscanned, receiver, columns, options, authorizations,
-            ClientConfigurationHelper.getClientRpcConfiguration(instance), timeoutTracker);
+        doLookup(context, tsLocation, tabletsRanges, tsFailures, unscanned, receiver, columns, options, authorizations, timeoutTracker);
         if (tsFailures.size() > 0) {
           locator.invalidateCache(tsFailures.keySet());
           synchronized (failures) {
@@ -358,7 +354,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
           failures.putAll(unscanned);
         }
         
-        locator.invalidateCache(tsLocation);
+        locator.invalidateCache(context.getInstance(), tsLocation);
         log.debug(e.getMessage(), e);
       } catch (AccumuloSecurityException e) {
         e.setTableInfo(getTableInfo());
@@ -586,16 +582,15 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
     }
   }
   
-  public static void doLookup(Instance instance, Credentials credentials, String server, Map<KeyExtent,List<Range>> requested,
-      Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>> unscanned, ResultReceiver receiver, List<Column> columns, ScannerOptions options,
-      Authorizations authorizations, AccumuloConfiguration conf) throws IOException, AccumuloSecurityException, AccumuloServerException {
-    doLookup(instance, credentials, server, requested, failures, unscanned, receiver, columns, options, authorizations, conf,
-        new TimeoutTracker(Long.MAX_VALUE));
+  public static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Range>> requested, Map<KeyExtent,List<Range>> failures,
+      Map<KeyExtent,List<Range>> unscanned, ResultReceiver receiver, List<Column> columns, ScannerOptions options, Authorizations authorizations)
+      throws IOException, AccumuloSecurityException, AccumuloServerException {
+    doLookup(context, server, requested, failures, unscanned, receiver, columns, options, authorizations, new TimeoutTracker(Long.MAX_VALUE));
   }
   
-  static void doLookup(Instance instance, Credentials credentials, String server, Map<KeyExtent,List<Range>> requested, Map<KeyExtent,List<Range>> failures,
+  static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Range>> requested, Map<KeyExtent,List<Range>> failures,
       Map<KeyExtent,List<Range>> unscanned, ResultReceiver receiver, List<Column> columns, ScannerOptions options, Authorizations authorizations,
-      AccumuloConfiguration conf, TimeoutTracker timeoutTracker) throws IOException, AccumuloSecurityException, AccumuloServerException {
+      TimeoutTracker timeoutTracker) throws IOException, AccumuloSecurityException, AccumuloServerException {
     
     if (requested.size() == 0) {
       return;
@@ -614,10 +609,10 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
     TTransport transport = null;
     try {
       TabletClientService.Client client;
-      if (timeoutTracker.getTimeOut() < conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT))
-        client = ThriftUtil.getTServerClient(server, conf, timeoutTracker.getTimeOut());
+      if (timeoutTracker.getTimeOut() < context.getClientTimeoutInMillis())
+        client = ThriftUtil.getTServerClient(server, context, timeoutTracker.getTimeOut());
       else
-        client = ThriftUtil.getTServerClient(server, conf);
+        client = ThriftUtil.getTServerClient(server, context);
       
       try {
         
@@ -629,7 +624,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
         
         Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested, Translators.KET, new Translator.ListTranslator<Range,TRange>(
             Translators.RT));
-        InitialMultiScan imsr = client.startMultiScan(Tracer.traceInfo(), credentials.toThrift(instance), thriftTabletRanges,
+        InitialMultiScan imsr = client.startMultiScan(Tracer.traceInfo(), context.rpcCreds(), thriftTabletRanges,
             Translator.translate(columns, Translators.CT), options.serverSideIteratorList, options.serverSideIteratorOptions,
             ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()), waitForWrites);
         if (waitForWrites)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
index a73fdec..a6112da 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
@@ -39,7 +39,6 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Durability;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.TableDeletedException;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -48,8 +47,6 @@ import org.apache.accumulo.core.client.TimedOutException;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations;
 import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.constraints.Violations;
 import org.apache.accumulo.core.data.ConstraintViolationSummary;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -57,7 +54,6 @@ import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.thrift.TMutation;
 import org.apache.accumulo.core.data.thrift.UpdateErrors;
 import org.apache.accumulo.core.master.state.tables.TableState;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
 import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
@@ -103,8 +99,7 @@ public class TabletServerBatchWriter {
   private static final Logger log = Logger.getLogger(TabletServerBatchWriter.class);
   
   // basic configuration
-  private final Instance instance;
-  private final Credentials credentials;
+  private final ClientContext context;
   private final long maxMem;
   private final long maxLatency;
   private final long timeout;
@@ -191,11 +186,10 @@ public class TabletServerBatchWriter {
     }
   }
   
-  public TabletServerBatchWriter(Instance instance, Credentials credentials, BatchWriterConfig config) {
-    this.instance = instance;
+  public TabletServerBatchWriter(ClientContext context, BatchWriterConfig config) {
+    this.context = context;
     this.maxMem = config.getMaxMemory();
     this.maxLatency = config.getMaxLatency(TimeUnit.MILLISECONDS) <= 0 ? Long.MAX_VALUE : config.getMaxLatency(TimeUnit.MILLISECONDS);
-    this.credentials = credentials;
     this.timeout = config.getTimeout(TimeUnit.MILLISECONDS);
     this.mutations = new MutationSet();
     this.lastProcessingStartTime = System.currentTimeMillis();
@@ -473,9 +467,9 @@ public class TabletServerBatchWriter {
       for (KeyExtent ke : authorizationFailures.keySet())
         tableIds.add(ke.getTableId().toString());
       
-      Tables.clearCache(instance);
+      Tables.clearCache(context.getInstance());
       for (String tableId : tableIds)
-        if (!Tables.exists(instance, tableId))
+        if (!Tables.exists(context.getInstance(), tableId))
           throw new TableDeletedException(tableId);
       
       synchronized (this) {
@@ -529,7 +523,7 @@ public class TabletServerBatchWriter {
         af.put(entry.getKey(), codes);
       }
       
-      throw new MutationsRejectedException(instance, cvsList, af, serverSideErrors, unknownErrors, lastUnknownError);
+      throw new MutationsRejectedException(context.getInstance(), cvsList, af, serverSideErrors, unknownErrors, lastUnknownError);
     }
   }
   
@@ -626,7 +620,7 @@ public class TabletServerBatchWriter {
     private TabletLocator getLocator(String tableId) {
       TabletLocator ret = locators.get(tableId);
       if (ret == null) {
-        ret = TabletLocator.getLocator(instance, new Text(tableId));
+        ret = TabletLocator.getLocator(context, new Text(tableId));
         ret = new TimeoutTabletLocator(ret, timeout);
         locators.put(tableId, ret);
       }
@@ -647,16 +641,16 @@ public class TabletServerBatchWriter {
           
           if (tableMutations != null) {
             ArrayList<Mutation> tableFailures = new ArrayList<Mutation>();
-            locator.binMutations(credentials, tableMutations, binnedMutations, tableFailures);
+            locator.binMutations(context, tableMutations, binnedMutations, tableFailures);
             
             if (tableFailures.size() > 0) {
               failedMutations.add(table, tableFailures);
               
               if (tableFailures.size() == tableMutations.size())
-                if (!Tables.exists(instance, entry.getKey()))
+                if (!Tables.exists(context.getInstance(), entry.getKey()))
                   throw new TableDeletedException(entry.getKey());
-                else if (Tables.getTableState(instance, table) == TableState.OFFLINE)
-                  throw new TableOfflineException(instance, entry.getKey());
+                else if (Tables.getTableState(context.getInstance(), table) == TableState.OFFLINE)
+                  throw new TableOfflineException(context.getInstance(), entry.getKey());
             }
           }
           
@@ -828,7 +822,7 @@ public class TabletServerBatchWriter {
             tables.add(ke.getTableId().toString());
           
           for (String table : tables)
-            TabletLocator.getLocator(instance, new Text(table)).invalidateCache(location);
+            TabletLocator.getLocator(context, new Text(table)).invalidateCache(context.getInstance(), location);
           
           failedMutations.add(location, tsm);
         } finally {
@@ -849,11 +843,10 @@ public class TabletServerBatchWriter {
       try {
         TabletClientService.Iface client;
         
-        AccumuloConfiguration rpcConfig = ClientConfigurationHelper.getClientRpcConfiguration(instance);
-        if (timeoutTracker.getTimeOut() < rpcConfig.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT))
-          client = ThriftUtil.getTServerClient(location, rpcConfig, timeoutTracker.getTimeOut());
+        if (timeoutTracker.getTimeOut() < context.getClientTimeoutInMillis())
+          client = ThriftUtil.getTServerClient(location, context, timeoutTracker.getTimeOut());
         else
-          client = ThriftUtil.getTServerClient(location, rpcConfig);
+          client = ThriftUtil.getTServerClient(location, context);
         
         try {
           MutationSet allFailures = new MutationSet();
@@ -862,17 +855,17 @@ public class TabletServerBatchWriter {
             Entry<KeyExtent,List<Mutation>> entry = tabMuts.entrySet().iterator().next();
             
             try {
-              client.update(tinfo, credentials.toThrift(instance), entry.getKey().toThrift(), entry.getValue().get(0).toThrift(), DurabilityImpl.toThrift(durability));
+              client.update(tinfo, context.rpcCreds(), entry.getKey().toThrift(), entry.getValue().get(0).toThrift(), DurabilityImpl.toThrift(durability));
             } catch (NotServingTabletException e) {
               allFailures.addAll(entry.getKey().getTableId().toString(), entry.getValue());
-              TabletLocator.getLocator(instance, new Text(entry.getKey().getTableId())).invalidateCache(entry.getKey());
+              TabletLocator.getLocator(context, new Text(entry.getKey().getTableId())).invalidateCache(entry.getKey());
             } catch (ConstraintViolationException e) {
               updatedConstraintViolations(Translator.translate(e.violationSummaries, Translators.TCVST));
             }
             timeoutTracker.madeProgress();
           } else {
             
-            long usid = client.startUpdate(tinfo, credentials.toThrift(instance), DurabilityImpl.toThrift(durability));
+            long usid = client.startUpdate(tinfo, context.rpcCreds(), DurabilityImpl.toThrift(durability));
             
             List<TMutation> updates = new ArrayList<TMutation>();
             for (Entry<KeyExtent,List<Mutation>> entry : tabMuts.entrySet()) {
@@ -906,7 +899,7 @@ public class TabletServerBatchWriter {
               
               String table = failedExtent.getTableId().toString();
               
-              TabletLocator.getLocator(instance, new Text(table)).invalidateCache(failedExtent);
+              TabletLocator.getLocator(context, new Text(table)).invalidateCache(failedExtent);
               
               ArrayList<Mutation> mutations = (ArrayList<Mutation>) tabMuts.get(failedExtent);
               allFailures.addAll(table, mutations.subList(numCommitted, mutations.size()));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
index 8e601d2..4b7d9ae 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
@@ -36,7 +36,6 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.Column;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -50,7 +49,6 @@ import org.apache.accumulo.core.data.thrift.ScanResult;
 import org.apache.accumulo.core.data.thrift.TKeyValue;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
@@ -78,24 +76,23 @@ public class ThriftScanner {
     }
   }
   
-  public static boolean getBatchFromServer(Instance instance, Credentials credentials, Range range, KeyExtent extent, String server,
-      SortedMap<Key,Value> results, SortedSet<Column> fetchedColumns, List<IterInfo> serverSideIteratorList,
-      Map<String,Map<String,String>> serverSideIteratorOptions, int size, Authorizations authorizations, boolean retry, AccumuloConfiguration conf)
-      throws AccumuloException, AccumuloSecurityException, NotServingTabletException {
+  public static boolean getBatchFromServer(ClientContext context, Range range, KeyExtent extent, String server, SortedMap<Key,Value> results,
+      SortedSet<Column> fetchedColumns, List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, int size,
+      Authorizations authorizations, boolean retry) throws AccumuloException, AccumuloSecurityException, NotServingTabletException {
     if (server == null)
       throw new AccumuloException(new IOException());
     
     try {
       TInfo tinfo = Tracer.traceInfo();
-      TabletClientService.Client client = ThriftUtil.getTServerClient(server, conf);
+      TabletClientService.Client client = ThriftUtil.getTServerClient(server, context);
       try {
         // not reading whole rows (or stopping on row boundries) so there is no need to enable isolation below
-        ScanState scanState = new ScanState(instance, credentials, extent.getTableId(), authorizations, range, fetchedColumns, size, serverSideIteratorList,
+        ScanState scanState = new ScanState(context, extent.getTableId(), authorizations, range, fetchedColumns, size, serverSideIteratorList,
             serverSideIteratorOptions, false);
         
         TabletType ttype = TabletType.type(extent);
         boolean waitForWrites = !serversWaitedForWrites.get(ttype).contains(server);
-        InitialScan isr = client.startScan(tinfo, scanState.credentials.toThrift(instance), extent.toThrift(), scanState.range.toThrift(),
+        InitialScan isr = client.startScan(tinfo, scanState.context.rpcCreds(), extent.toThrift(), scanState.range.toThrift(),
             Translator.translate(scanState.columns, Translators.CT), scanState.size, scanState.serverSideIteratorList, scanState.serverSideIteratorOptions,
             scanState.authorizations.getAuthorizationsBB(), waitForWrites, scanState.isolated, scanState.readaheadThreshold);
         if (waitForWrites)
@@ -138,8 +135,7 @@ public class ThriftScanner {
     
     int size;
     
-    Instance instance;
-    Credentials credentials;
+    ClientContext context;
     Authorizations authorizations;
     List<Column> columns;
     
@@ -152,16 +148,16 @@ public class ThriftScanner {
     
     Map<String,Map<String,String>> serverSideIteratorOptions;
 
-    public ScanState(Instance instance, Credentials credentials, Text tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns,
-        int size, List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated) {
-      this(instance, credentials, tableId, authorizations, range, fetchedColumns, size, serverSideIteratorList, serverSideIteratorOptions, isolated,
+    public ScanState(ClientContext context, Text tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns, int size,
+        List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated) {
+      this(context, tableId, authorizations, range, fetchedColumns, size, serverSideIteratorList, serverSideIteratorOptions, isolated,
           Constants.SCANNER_DEFAULT_READAHEAD_THRESHOLD);
     }
 
-    public ScanState(Instance instance, Credentials credentials, Text tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns,
-        int size, List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated, long readaheadThreshold) {
-      this.instance = instance;
-      this.credentials = credentials;
+    public ScanState(ClientContext context, Text tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns, int size,
+        List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated, long readaheadThreshold) {
+      this.context = context;
+      ;
       this.authorizations = authorizations;
       
       columns = new ArrayList<Column>(fetchedColumns.size());
@@ -197,10 +193,10 @@ public class ThriftScanner {
     
   }
   
-  public static List<KeyValue> scan(Instance instance, Credentials credentials, ScanState scanState, int timeOut, AccumuloConfiguration conf)
-      throws ScanTimedOutException, AccumuloException, AccumuloSecurityException, TableNotFoundException {
+  public static List<KeyValue> scan(ClientContext context, ScanState scanState, int timeOut) throws ScanTimedOutException, AccumuloException,
+      AccumuloSecurityException, TableNotFoundException {
     TabletLocation loc = null;
-    
+    Instance instance = context.getInstance();
     long startTime = System.currentTimeMillis();
     String lastError = null;
     String error = null;
@@ -225,7 +221,7 @@ public class ThriftScanner {
           
           Span locateSpan = Trace.start("scan:locateTablet");
           try {
-            loc = TabletLocator.getLocator(instance, scanState.tableId).locateTablet(credentials, scanState.startRow, scanState.skipStartRow, false);
+            loc = TabletLocator.getLocator(context, scanState.tableId).locateTablet(context, scanState.startRow, scanState.skipStartRow, false);
             
             if (loc == null) {
               if (!Tables.exists(instance, scanState.tableId.toString()))
@@ -276,7 +272,7 @@ public class ThriftScanner {
         Span scanLocation = Trace.start("scan:location");
         scanLocation.data("tserver", loc.tablet_location);
         try {
-          results = scan(loc, scanState, conf);
+          results = scan(loc, scanState, context);
         } catch (AccumuloSecurityException e) {
           Tables.clearCache(instance);
           if (!Tables.exists(instance, scanState.tableId.toString()))
@@ -293,7 +289,7 @@ public class ThriftScanner {
             log.trace(error);
           lastError = error;
           
-          TabletLocator.getLocator(instance, scanState.tableId).invalidateCache(loc.tablet_extent);
+          TabletLocator.getLocator(context, scanState.tableId).invalidateCache(loc.tablet_extent);
           loc = null;
           
           // no need to try the current scan id somewhere else
@@ -339,7 +335,7 @@ public class ThriftScanner {
           
           Thread.sleep(100);
         } catch (TException e) {
-          TabletLocator.getLocator(instance, scanState.tableId).invalidateCache(loc.tablet_location);
+          TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context.getInstance(), loc.tablet_location);
           error = "Scan failed, thrift error " + e.getClass().getName() + "  " + e.getMessage() + " " + loc;
           if (!error.equals(lastError))
             log.debug(error);
@@ -373,7 +369,7 @@ public class ThriftScanner {
     }
   }
   
-  private static List<KeyValue> scan(TabletLocation loc, ScanState scanState, AccumuloConfiguration conf) throws AccumuloSecurityException,
+  private static List<KeyValue> scan(TabletLocation loc, ScanState scanState, ClientContext context) throws AccumuloSecurityException,
       NotServingTabletException, TException, NoSuchScanIDException, TooManyFilesException {
     if (scanState.finished)
       return null;
@@ -381,7 +377,7 @@ public class ThriftScanner {
     OpTimer opTimer = new OpTimer(log, Level.TRACE);
     
     TInfo tinfo = Tracer.traceInfo();
-    TabletClientService.Client client = ThriftUtil.getTServerClient(loc.tablet_location, conf);
+    TabletClientService.Client client = ThriftUtil.getTServerClient(loc.tablet_location, context);
     
     String old = Thread.currentThread().getName();
     try {
@@ -400,7 +396,7 @@ public class ThriftScanner {
         
         TabletType ttype = TabletType.type(loc.tablet_extent);
         boolean waitForWrites = !serversWaitedForWrites.get(ttype).contains(loc.tablet_location);
-        InitialScan is = client.startScan(tinfo, scanState.credentials.toThrift(scanState.instance), loc.tablet_extent.toThrift(), scanState.range.toThrift(),
+        InitialScan is = client.startScan(tinfo, scanState.context.rpcCreds(), loc.tablet_extent.toThrift(), scanState.range.toThrift(),
             Translator.translate(scanState.columns, Translators.CT), scanState.size, scanState.serverSideIteratorList, scanState.serverSideIteratorOptions,
             scanState.authorizations.getAuthorizationsBB(), waitForWrites, scanState.isolated, scanState.readaheadThreshold);
         if (waitForWrites)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportKey.java
----------------------------------------------------------------------
diff --git 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
index 3791d63..a3a4f25 100644
--- 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
@@ -17,6 +17,7 @@
 package org.apache.accumulo.core.client.impl;
 
 import static com.google.common.base.Preconditions.checkArgument;
+
 import org.apache.accumulo.core.util.SslConnectionParams;
 
 class ThriftTransportKey {
@@ -27,7 +28,7 @@ class ThriftTransportKey {
   
   private int hash = -1;
   
-  ThriftTransportKey(String location, long timeout, SslConnectionParams sslParams) {
+  ThriftTransportKey(String location, long timeout, ClientContext context) {
     checkArgument(location != null, "location is null");
     String[] locationAndPort = location.split(":", 2);
     if (locationAndPort.length == 2) {
@@ -37,7 +38,7 @@ class ThriftTransportKey {
       throw new IllegalArgumentException("Location was expected to contain port but did not. location=" + location);
     
     this.timeout = timeout;
-    this.sslParams = sslParams;
+    this.sslParams = context.getClientSslParams();
   }
   
   String getLocation() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
----------------------------------------------------------------------
diff --git 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
index 4f3c661..3380e13 100644
--- 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,11 +31,8 @@ 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.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;
@@ -389,12 +386,12 @@ public class ThriftTransportPool {
   
   private ThriftTransportPool() {}
   
-  public TTransport getTransportWithDefaultTimeout(HostAndPort addr, AccumuloConfiguration conf) throws TTransportException {
-    return getTransport(String.format("%s:%d", addr.getHostText(), addr.getPort()), conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT), SslConnectionParams.forClient(conf));
+  public TTransport getTransportWithDefaultTimeout(HostAndPort addr, ClientContext context) throws TTransportException {
+    return getTransport(String.format("%s:%d", addr.getHostText(), addr.getPort()), context.getClientTimeoutInMillis(), context);
   }
   
-  public TTransport getTransport(String location, long milliseconds, SslConnectionParams sslParams) throws TTransportException {
-    return getTransport(new ThriftTransportKey(location, milliseconds, sslParams));
+  public TTransport getTransport(String location, long milliseconds, ClientContext context) throws TTransportException {
+    return getTransport(new ThriftTransportKey(location, milliseconds, context));
   }
   
   private TTransport getTransport(ThriftTransportKey cacheKey) throws TTransportException {
@@ -484,7 +481,8 @@ public class ThriftTransportPool {
   }
   
   private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException {
-    TTransport transport = ThriftUtil.createClientTransport(HostAndPort.fromParts(cacheKey.getLocation(), cacheKey.getPort()), (int)cacheKey.getTimeout(), cacheKey.getSslParams());
+    TTransport transport = ThriftUtil.createClientTransport(HostAndPort.fromParts(cacheKey.getLocation(), cacheKey.getPort()), (int) cacheKey.getTimeout(),
+        cacheKey.getSslParams());
 
     if (log.isTraceEnabled())
       log.trace("Creating new connection to connection to " + cacheKey.getLocation() + ":" + cacheKey.getPort());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java
index bcbe561..644ba31 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java
@@ -22,12 +22,12 @@ import java.util.Map;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TimedOutException;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -57,11 +57,11 @@ public class TimeoutTabletLocator extends TabletLocator {
   }
   
   @Override
-  public TabletLocation locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
+  public TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException {
     
     try {
-      TabletLocation ret = locator.locateTablet(credentials, row, skipRow, retry);
+      TabletLocation ret = locator.locateTablet(context, row, skipRow, retry);
       
       if (ret == null)
         failed();
@@ -76,10 +76,10 @@ public class TimeoutTabletLocator extends TabletLocator {
   }
   
   @Override
-  public <T extends Mutation> void binMutations(Credentials credentials, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
+  public <T extends Mutation> void binMutations(ClientContext context, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
       throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     try {
-      locator.binMutations(credentials, mutations, binnedMutations, failures);
+      locator.binMutations(context, mutations, binnedMutations, failures);
       
       if (failures.size() == mutations.size())
         failed();
@@ -97,11 +97,11 @@ public class TimeoutTabletLocator extends TabletLocator {
    */
   
   @Override
-  public List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
+  public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException {
     
     try {
-      List<Range> ret = locator.binRanges(credentials, ranges, binnedRanges);
+      List<Range> ret = locator.binRanges(context, ranges, binnedRanges);
       
       if (ranges.size() == ret.size())
         failed();
@@ -131,8 +131,8 @@ public class TimeoutTabletLocator extends TabletLocator {
   }
   
   @Override
-  public void invalidateCache(String server) {
-    locator.invalidateCache(server);
+  public void invalidateCache(Instance instance, String server) {
+    locator.invalidateCache(instance, server);
   }
   
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
index 7b307d8..df7074d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
@@ -21,14 +21,11 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TDurability;
@@ -45,34 +42,31 @@ public class Writer {
   
   private static final Logger log = Logger.getLogger(Writer.class);
   
-  private Instance instance;
-  private Credentials credentials;
+  private ClientContext context;
   private Text table;
   
-  public Writer(Instance instance, Credentials credentials, Text table) {
-    checkArgument(instance != null, "instance is null");
-    checkArgument(credentials != null, "credentials is null");
+  public Writer(ClientContext context, Text table) {
+    checkArgument(context != null, "context is null");
     checkArgument(table != null, "table is null");
-    this.instance = instance;
-    this.credentials = credentials;
+    this.context = context;
     this.table = table;
   }
   
-  public Writer(Instance instance, Credentials credentials, String table) {
-    this(instance, credentials, new Text(table));
+  public Writer(ClientContext context, String table) {
+    this(context, new Text(table));
   }
   
-  private static void updateServer(Instance instance, Mutation m, KeyExtent extent, String server, Credentials ai, AccumuloConfiguration configuration)
-      throws TException, NotServingTabletException, ConstraintViolationException, AccumuloSecurityException {
+  private static void updateServer(ClientContext context, Mutation m, KeyExtent extent, String server) throws TException, NotServingTabletException,
+      ConstraintViolationException, AccumuloSecurityException {
     checkArgument(m != null, "m is null");
     checkArgument(extent != null, "extent is null");
     checkArgument(server != null, "server is null");
-    checkArgument(ai != null, "ai is null");
+    checkArgument(context != null, "context is null");
     
     TabletClientService.Iface client = null;
     try {
-      client = ThriftUtil.getTServerClient(server, configuration);
-      client.update(Tracer.traceInfo(), ai.toThrift(instance), extent.toThrift(), m.toThrift(), TDurability.DEFAULT);
+      client = ThriftUtil.getTServerClient(server, context);
+      client.update(Tracer.traceInfo(), context.rpcCreds(), extent.toThrift(), m.toThrift(), TDurability.DEFAULT);
       return;
     } catch (ThriftSecurityException e) {
       throw new AccumuloSecurityException(e.user, e.code);
@@ -88,7 +82,7 @@ public class Writer {
       throw new IllegalArgumentException("Can not add empty mutations");
     
     while (true) {
-      TabletLocation tabLoc = TabletLocator.getLocator(instance, table).locateTablet(credentials, new Text(m.getRow()), false, true);
+      TabletLocation tabLoc = TabletLocator.getLocator(context, table).locateTablet(context, new Text(m.getRow()), false, true);
       
       if (tabLoc == null) {
         log.trace("No tablet location found for row " + new String(m.getRow(), UTF_8));
@@ -97,19 +91,19 @@ public class Writer {
       }
       
       try {
-        updateServer(instance, m, tabLoc.tablet_extent, tabLoc.tablet_location, credentials, ClientConfigurationHelper.getClientRpcConfiguration(instance));
+        updateServer(context, m, tabLoc.tablet_extent, tabLoc.tablet_location);
         return;
       } catch (NotServingTabletException e) {
         log.trace("Not serving tablet, server = " + tabLoc.tablet_location);
-        TabletLocator.getLocator(instance, table).invalidateCache(tabLoc.tablet_extent);
+        TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent);
       } catch (ConstraintViolationException cve) {
         log.error("error sending update to " + tabLoc.tablet_location + ": " + cve);
         // probably do not need to invalidate cache, but it does not hurt
-        TabletLocator.getLocator(instance, table).invalidateCache(tabLoc.tablet_extent);
+        TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent);
         throw cve;
       } catch (TException e) {
         log.error("error sending update to " + tabLoc.tablet_location + ": " + e);
-        TabletLocator.getLocator(instance, table).invalidateCache(tabLoc.tablet_extent);
+        TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent);
       }
       
       UtilWaitThread.sleep(500);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java
index 35f160f..8927495 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java
@@ -23,25 +23,26 @@ import java.util.Map;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.TabletLocator;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.hadoop.io.Text;
 
 public class MockTabletLocator extends TabletLocator {
   public MockTabletLocator() {}
 
   @Override
-  public TabletLocation locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
+  public TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException {
     throw new UnsupportedOperationException();
   }
 
   @Override
-  public <T extends Mutation> void binMutations(Credentials credentials, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
+  public <T extends Mutation> void binMutations(ClientContext context, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
       throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     TabletServerMutations<T> tsm = new TabletServerMutations<T>("5");
     for (T m : mutations)
@@ -50,7 +51,7 @@ public class MockTabletLocator extends TabletLocator {
   }
 
   @Override
-  public List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
+  public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException {
     binnedRanges.put("", Collections.singletonMap(new KeyExtent(new Text(), null, null), ranges));
     return Collections.emptyList();
@@ -66,5 +67,5 @@ public class MockTabletLocator extends TabletLocator {
   public void invalidateCache() {}
 
   @Override
-  public void invalidateCache(String server) {}
+  public void invalidateCache(Instance instance, String server) {}
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java
index c7fe137..b40a6bd 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java
@@ -31,10 +31,9 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.AccumuloServerException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.ScannerOptions;
-import org.apache.accumulo.core.client.impl.ClientConfigurationHelper;
 import org.apache.accumulo.core.client.impl.TabletLocator;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocations;
@@ -42,7 +41,6 @@ import org.apache.accumulo.core.client.impl.TabletLocatorImpl.TabletLocationObta
 import org.apache.accumulo.core.client.impl.TabletServerBatchReaderIterator;
 import org.apache.accumulo.core.client.impl.TabletServerBatchReaderIterator.ResultReceiver;
 import org.apache.accumulo.core.client.impl.ThriftScanner;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.Column;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -53,7 +51,6 @@ import org.apache.accumulo.core.data.thrift.IterInfo;
 import org.apache.accumulo.core.iterators.user.WholeRowIterator;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.TextUtil;
@@ -65,13 +62,8 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
   private static final Logger log = Logger.getLogger(MetadataLocationObtainer.class);
   private SortedSet<Column> locCols;
   private ArrayList<Column> columns;
-  private Instance instance;
-  private AccumuloConfiguration rpcConfig;
   
-  public MetadataLocationObtainer(Instance instance) {
-    
-    this.instance = instance;
-    this.rpcConfig = ClientConfigurationHelper.getClientRpcConfiguration(instance);
+  public MetadataLocationObtainer() {
     
     locCols = new TreeSet<Column>();
     locCols.add(new Column(TextUtil.getBytes(TabletsSection.CurrentLocationColumnFamily.NAME), null, null));
@@ -80,7 +72,7 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
   }
   
   @Override
-  public TabletLocations lookupTablet(Credentials credentials, TabletLocation src, Text row, Text stopRow, TabletLocator parent)
+  public TabletLocations lookupTablet(ClientContext context, TabletLocation src, Text row, Text stopRow, TabletLocator parent)
       throws AccumuloSecurityException, AccumuloException {
     
     try {
@@ -99,17 +91,16 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
       List<IterInfo> serverSideIteratorList = new ArrayList<IterInfo>();
       serverSideIteratorList.add(new IterInfo(10000, WholeRowIterator.class.getName(), "WRI"));
       Map<String,Map<String,String>> serverSideIteratorOptions = Collections.emptyMap();
-      
-      boolean more = ThriftScanner.getBatchFromServer(instance, credentials, range, src.tablet_extent, src.tablet_location, encodedResults, locCols,
-          serverSideIteratorList, serverSideIteratorOptions, Constants.SCAN_BATCH_SIZE, Authorizations.EMPTY, false, rpcConfig);
+      boolean more = ThriftScanner.getBatchFromServer(context, range, src.tablet_extent, src.tablet_location, encodedResults, locCols, serverSideIteratorList,
+          serverSideIteratorOptions, Constants.SCAN_BATCH_SIZE, Authorizations.EMPTY, false);
       
       decodeRows(encodedResults, results);
       
       if (more && results.size() == 1) {
         range = new Range(results.lastKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME), true, new Key(stopRow).followingKey(PartialKey.ROW), false);
         encodedResults.clear();
-        more = ThriftScanner.getBatchFromServer(instance, credentials, range, src.tablet_extent, src.tablet_location, encodedResults, locCols,
-            serverSideIteratorList, serverSideIteratorOptions, Constants.SCAN_BATCH_SIZE, Authorizations.EMPTY, false, rpcConfig);
+        more = ThriftScanner.getBatchFromServer(context, range, src.tablet_extent, src.tablet_location, encodedResults, locCols, serverSideIteratorList,
+            serverSideIteratorOptions, Constants.SCAN_BATCH_SIZE, Authorizations.EMPTY, false);
         
         decodeRows(encodedResults, results);
       }
@@ -132,7 +123,7 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
     } catch (AccumuloException e) {
       if (log.isTraceEnabled())
         log.trace(src.tablet_extent.getTableId() + " lookup failed", e);
-      parent.invalidateCache(src.tablet_location);
+      parent.invalidateCache(context.getInstance(), src.tablet_location);
     }
     
     return null;
@@ -149,7 +140,7 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
   }
   
   @Override
-  public List<TabletLocation> lookupTablets(Credentials credentials, String tserver, Map<KeyExtent,List<Range>> tabletsRanges, TabletLocator parent)
+  public List<TabletLocation> lookupTablets(ClientContext context, String tserver, Map<KeyExtent,List<Range>> tabletsRanges, TabletLocator parent)
       throws AccumuloSecurityException, AccumuloException {
     
     final TreeMap<Key,Value> results = new TreeMap<Key,Value>();
@@ -181,8 +172,7 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
     Map<KeyExtent,List<Range>> unscanned = new HashMap<KeyExtent,List<Range>>();
     Map<KeyExtent,List<Range>> failures = new HashMap<KeyExtent,List<Range>>();
     try {
-      TabletServerBatchReaderIterator.doLookup(instance, credentials, tserver, tabletsRanges, failures, unscanned, rr, columns, opts, Authorizations.EMPTY,
-          ClientConfigurationHelper.getClientRpcConfiguration(instance));
+      TabletServerBatchReaderIterator.doLookup(context, tserver, tabletsRanges, failures, unscanned, rr, columns, opts, Authorizations.EMPTY);
       if (failures.size() > 0) {
         // invalidate extents in parents cache
         if (log.isTraceEnabled())
@@ -191,7 +181,7 @@ public class MetadataLocationObtainer implements TabletLocationObtainer {
       }
     } catch (IOException e) {
       log.trace("lookupTablets failed server=" + tserver, e);
-      parent.invalidateCache(tserver);
+      parent.invalidateCache(context.getInstance(), tserver);
     } catch (AccumuloServerException e) {
       log.trace("lookupTablets failed server=" + tserver, e);
       throw e;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
index 7a503b7..7d9592b 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
@@ -17,35 +17,33 @@
 package org.apache.accumulo.core.metadata;
 
 import static com.google.common.base.Preconditions.checkArgument;
+
 import java.util.SortedMap;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.security.Credentials;
 
 /**
  * Provides a consolidated API for handling table metadata
  */
 public abstract class MetadataServicer {
   
-  public static MetadataServicer forTableName(Instance instance, Credentials credentials, String tableName) throws AccumuloException, AccumuloSecurityException {
+  public static MetadataServicer forTableName(ClientContext context, String tableName) throws AccumuloException, AccumuloSecurityException {
     checkArgument(tableName != null, "tableName is null");
-    Connector conn = instance.getConnector(credentials.getPrincipal(), credentials.getToken());
-    return forTableId(instance, credentials, conn.tableOperations().tableIdMap().get(tableName));
+    return forTableId(context, context.getConnector().tableOperations().tableIdMap().get(tableName));
   }
   
-  public static MetadataServicer forTableId(Instance instance, Credentials credentials, String tableId) {
+  public static MetadataServicer forTableId(ClientContext context, String tableId) {
     checkArgument(tableId != null, "tableId is null");
     if (RootTable.ID.equals(tableId))
-      return new ServicerForRootTable(instance, credentials);
+      return new ServicerForRootTable(context);
     else if (MetadataTable.ID.equals(tableId))
-      return new ServicerForMetadataTable(instance, credentials);
+      return new ServicerForMetadataTable(context);
     else
-      return new ServicerForUserTables(instance, credentials, tableId);
+      return new ServicerForUserTables(context, tableId);
   }
   
   /**

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
index 0802994..29f7027 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
@@ -16,8 +16,7 @@
  */
 package org.apache.accumulo.core.metadata;
 
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.security.Credentials;
+import org.apache.accumulo.core.client.impl.ClientContext;
 
 /**
  * A metadata servicer for the metadata table (which holds metadata for user tables).<br />
@@ -25,8 +24,8 @@ import org.apache.accumulo.core.security.Credentials;
  */
 class ServicerForMetadataTable extends TableMetadataServicer {
   
-  public ServicerForMetadataTable(Instance instance, Credentials credentials) {
-    super(instance, credentials, RootTable.NAME, MetadataTable.ID);
+  public ServicerForMetadataTable(ClientContext context) {
+    super(context, RootTable.NAME, MetadataTable.ID);
   }
   
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
index 4da517c..b13149e 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
@@ -22,8 +22,8 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.security.Credentials;
 
 /**
  * A metadata servicer for the root table.<br />
@@ -31,10 +31,10 @@ import org.apache.accumulo.core.security.Credentials;
  */
 class ServicerForRootTable extends MetadataServicer {
   
-  private Instance instance;
+  private final Instance instance;
   
-  public ServicerForRootTable(Instance instance, Credentials credentials) {
-    this.instance = instance;
+  public ServicerForRootTable(ClientContext context) {
+    this.instance = context.getInstance();
   }
   
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java
index fd64e05..c9e2ede 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java
@@ -16,8 +16,7 @@
  */
 package org.apache.accumulo.core.metadata;
 
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.security.Credentials;
+import org.apache.accumulo.core.client.impl.ClientContext;
 
 /**
  * A metadata servicer for user tables.<br />
@@ -25,8 +24,8 @@ import org.apache.accumulo.core.security.Credentials;
  */
 class ServicerForUserTables extends TableMetadataServicer {
   
-  public ServicerForUserTables(Instance instance, Credentials credentials, String tableId) {
-    super(instance, credentials, MetadataTable.NAME, tableId);
+  public ServicerForUserTables(ClientContext context, String tableId) {
+    super(context, MetadataTable.NAME, tableId);
   }
   
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java b/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java
index a3800ed..fbba279 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java
@@ -23,15 +23,14 @@ import java.util.SortedSet;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -39,14 +38,12 @@ import org.apache.hadoop.io.Text;
  */
 abstract class TableMetadataServicer extends MetadataServicer {
   
-  private Instance instance;
-  private Credentials credentials;
+  private final ClientContext context;
   private String tableIdBeingServiced;
   private String serviceTableName;
   
-  public TableMetadataServicer(Instance instance, Credentials credentials, String serviceTableName, String tableIdBeingServiced) {
-    this.instance = instance;
-    this.credentials = credentials;
+  public TableMetadataServicer(ClientContext context, String serviceTableName, String tableIdBeingServiced) {
+    this.context = context;
     this.serviceTableName = serviceTableName;
     this.tableIdBeingServiced = tableIdBeingServiced;
   }
@@ -63,7 +60,7 @@ abstract class TableMetadataServicer extends MetadataServicer {
   @Override
   public void getTabletLocations(SortedMap<KeyExtent,String> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     
-    Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(getServicingTableName(), Authorizations.EMPTY);
+    Scanner scanner = context.getConnector().createScanner(getServicingTableName(), Authorizations.EMPTY);
     
     TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
     scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/replication/AccumuloReplicationReplayer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/replication/AccumuloReplicationReplayer.java b/core/src/main/java/org/apache/accumulo/core/replication/AccumuloReplicationReplayer.java
index 620381d..ff89196 100644
--- a/core/src/main/java/org/apache/accumulo/core/replication/AccumuloReplicationReplayer.java
+++ b/core/src/main/java/org/apache/accumulo/core/replication/AccumuloReplicationReplayer.java
@@ -16,8 +16,9 @@
  */
 package org.apache.accumulo.core.replication;
 
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.replication.thrift.KeyValues;
 import org.apache.accumulo.core.replication.thrift.RemoteReplicationException;
 import org.apache.accumulo.core.replication.thrift.WalEdits;
@@ -27,7 +28,9 @@ import org.apache.accumulo.core.replication.thrift.WalEdits;
  */
 public interface AccumuloReplicationReplayer {
 
-  public long replicateLog(Connector conn, AccumuloConfiguration conf, String tableName, WalEdits data) throws RemoteReplicationException;
-  public long replicateKeyValues(Connector conn, String tableName, KeyValues kvs) throws RemoteReplicationException;
+  public long replicateLog(ClientContext context, String tableName, WalEdits data) throws RemoteReplicationException, AccumuloException,
+      AccumuloSecurityException;
+
+  public long replicateKeyValues(ClientContext context, String tableName, KeyValues kvs) throws RemoteReplicationException;
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java b/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
index 88f5afc..619131a 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/ThriftUtil.java
@@ -38,12 +38,11 @@ import javax.net.ssl.TrustManagerFactory;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.ClientExec;
 import org.apache.accumulo.core.client.impl.ClientExecReturn;
 import org.apache.accumulo.core.client.impl.ThriftTransportPool;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.trace.Span;
 import org.apache.accumulo.core.trace.Trace;
@@ -105,26 +104,25 @@ public class ThriftUtil {
     return factory.getClient(protocolFactory.getProtocol(transport), protocolFactory.getProtocol(transport));
   }
 
-  static public <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, HostAndPort address, AccumuloConfiguration conf)
+  static public <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, HostAndPort address, ClientContext context)
       throws TTransportException {
-    return createClient(factory, ThriftTransportPool.getInstance().getTransportWithDefaultTimeout(address, conf));
+    return createClient(factory, ThriftTransportPool.getInstance().getTransportWithDefaultTimeout(address, context));
   }
 
-  static public <T extends TServiceClient> T getClientNoTimeout(TServiceClientFactory<T> factory, String address, AccumuloConfiguration configuration)
+  static public <T extends TServiceClient> T getClientNoTimeout(TServiceClientFactory<T> factory, String address, ClientContext context)
       throws TTransportException {
-    return getClient(factory, address, 0, configuration);
+    return getClient(factory, address, context, 0);
   }
 
-  static public <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, String address, Property timeoutProperty,
-      AccumuloConfiguration configuration) throws TTransportException {
-    long timeout = configuration.getTimeInMillis(timeoutProperty);
-    TTransport transport = ThriftTransportPool.getInstance().getTransport(address, timeout, SslConnectionParams.forClient(configuration));
+  static public <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, String address, ClientContext context)
+      throws TTransportException {
+    TTransport transport = ThriftTransportPool.getInstance().getTransport(address, context.getClientTimeoutInMillis(), context);
     return createClient(factory, transport);
   }
 
-  static public <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, String address, long timeout, AccumuloConfiguration configuration)
+  static private <T extends TServiceClient> T getClient(TServiceClientFactory<T> factory, String address, ClientContext context, long timeout)
       throws TTransportException {
-    TTransport transport = ThriftTransportPool.getInstance().getTransport(address, timeout, SslConnectionParams.forClient(configuration));
+    TTransport transport = ThriftTransportPool.getInstance().getTransport(address, timeout, context);
     return createClient(factory, transport);
   }
 
@@ -134,20 +132,20 @@ public class ThriftUtil {
     }
   }
 
-  static public TabletClientService.Client getTServerClient(String address, AccumuloConfiguration conf) throws TTransportException {
-    return getClient(new TabletClientService.Client.Factory(), address, Property.GENERAL_RPC_TIMEOUT, conf);
+  static public TabletClientService.Client getTServerClient(String address, ClientContext context) throws TTransportException {
+    return getClient(new TabletClientService.Client.Factory(), address, context);
   }
 
-  static public TabletClientService.Client getTServerClient(String address, AccumuloConfiguration conf, long timeout) throws TTransportException {
-    return getClient(new TabletClientService.Client.Factory(), address, timeout, conf);
+  static public TabletClientService.Client getTServerClient(String address, ClientContext context, long timeout) throws TTransportException {
+    return getClient(new TabletClientService.Client.Factory(), address, context, timeout);
   }
 
-  public static void execute(String address, AccumuloConfiguration conf, ClientExec<TabletClientService.Client> exec) throws AccumuloException,
+  public static void execute(String address, ClientContext context, ClientExec<TabletClientService.Client> exec) throws AccumuloException,
       AccumuloSecurityException {
     while (true) {
       TabletClientService.Client client = null;
       try {
-        exec.execute(client = getTServerClient(address, conf));
+        exec.execute(client = getTServerClient(address, context));
         break;
       } catch (TTransportException tte) {
         log.debug("getTServerClient request failed, retrying ... ", tte);
@@ -163,12 +161,12 @@ public class ThriftUtil {
     }
   }
 
-  public static <T> T execute(String address, AccumuloConfiguration conf, ClientExecReturn<T,TabletClientService.Client> exec) throws AccumuloException,
+  public static <T> T execute(String address, ClientContext context, ClientExecReturn<T,TabletClientService.Client> exec) throws AccumuloException,
       AccumuloSecurityException {
     while (true) {
       TabletClientService.Client client = null;
       try {
-        return exec.execute(client = getTServerClient(address, conf));
+        return exec.execute(client = getTServerClient(address, context));
       } catch (TTransportException tte) {
         log.debug("getTServerClient request failed, retrying ... ", tte);
         UtilWaitThread.sleep(100);
@@ -186,8 +184,8 @@ public class ThriftUtil {
   /**
    * create a transport that is not pooled
    */
-  public static TTransport createTransport(HostAndPort address, AccumuloConfiguration conf) throws TException {
-    return createClientTransport(address, (int) conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT), SslConnectionParams.forClient(conf));
+  public static TTransport createTransport(HostAndPort address, ClientContext context) throws TException {
+    return createClientTransport(address, (int) context.getClientTimeoutInMillis(), context.getClientSslParams());
   }
 
   public static TTransportFactory transportFactory() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfigurationHelperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfigurationHelperTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfigurationHelperTest.java
deleted file mode 100644
index 663ce22..0000000
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfigurationHelperTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.core.client.impl;
-
-import java.io.File;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.AccumuloConfiguration.AllFilter;
-import org.apache.accumulo.core.conf.CredentialProviderFactoryShim;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class ClientConfigurationHelperTest {
-
-  private static boolean isCredentialProviderAvailable = false;
-  private static final String keystoreName = "/site-cfg.jceks";
-
-  //site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', 'general.rpc.timeout'=>'timeout'}
-  private static File keystore;
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-    try {
-      Class.forName(CredentialProviderFactoryShim.HADOOP_CRED_PROVIDER_CLASS_NAME);
-      isCredentialProviderAvailable = true;
-    } catch (Exception e) {
-      isCredentialProviderAvailable = false;
-    }
-
-    if (isCredentialProviderAvailable) {
-      URL keystoreUrl = ClientConfigurationHelperTest.class.getResource(keystoreName);
-
-      Assert.assertNotNull("Could not find " + keystoreName, keystoreUrl);
-
-      keystore = new File(keystoreUrl.getFile());
-    }
-  }
-
-  protected String getKeyStoreUrl(File absoluteFilePath) {
-    return "jceks://file" + absoluteFilePath.getAbsolutePath();
-  }
-  
-  @Test
-  public void loadSensitivePropertyFromCredentialProvider() {
-    if (!isCredentialProviderAvailable) {
-      return;
-    }
-
-    String absPath = getKeyStoreUrl(keystore);
-    ClientConfiguration clientConf = new ClientConfiguration();
-    clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath);
-
-    AccumuloConfiguration accClientConf = ClientConfigurationHelper.convertClientConfig(DefaultConfiguration.getInstance(), clientConf);
-    Assert.assertEquals("mysecret", accClientConf.get(Property.INSTANCE_SECRET));
-  }
-  
-  @Test
-  public void defaultValueForSensitiveProperty() {
-    if (!isCredentialProviderAvailable) {
-      return;
-    }
-
-    ClientConfiguration clientConf = new ClientConfiguration();
-
-    AccumuloConfiguration accClientConf = ClientConfigurationHelper.convertClientConfig(DefaultConfiguration.getInstance(), clientConf);
-    Assert.assertEquals(Property.INSTANCE_SECRET.getDefaultValue(), accClientConf.get(Property.INSTANCE_SECRET));
-  }
-
-  @Test
-  public void sensitivePropertiesIncludedInProperties() {
-    if (!isCredentialProviderAvailable) {
-      return;
-    }
-
-    String absPath = getKeyStoreUrl(keystore);
-    ClientConfiguration clientConf = new ClientConfiguration();
-    clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath);
-
-    AccumuloConfiguration accClientConf = ClientConfigurationHelper.convertClientConfig(DefaultConfiguration.getInstance(), clientConf);
-    Map<String,String> props = new HashMap<String,String>();
-    accClientConf.getProperties(props, new AllFilter());
-
-    // Only sensitive properties are added
-    Assert.assertEquals(Property.GENERAL_RPC_TIMEOUT.getDefaultValue(), props.get(Property.GENERAL_RPC_TIMEOUT.getKey()));
-    // Only known properties are added
-    Assert.assertFalse(props.containsKey("ignored.property"));
-    Assert.assertEquals("mysecret", props.get(Property.INSTANCE_SECRET.getKey()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
new file mode 100644
index 0000000..2e3951d
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client.impl;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.AccumuloConfiguration.AllFilter;
+import org.apache.accumulo.core.conf.CredentialProviderFactoryShim;
+import org.apache.accumulo.core.conf.Property;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ClientContextTest {
+
+  private static boolean isCredentialProviderAvailable = false;
+  private static final String keystoreName = "/site-cfg.jceks";
+
+  //site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', 'general.rpc.timeout'=>'timeout'}
+  private static File keystore;
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    try {
+      Class.forName(CredentialProviderFactoryShim.HADOOP_CRED_PROVIDER_CLASS_NAME);
+      isCredentialProviderAvailable = true;
+    } catch (Exception e) {
+      isCredentialProviderAvailable = false;
+    }
+
+    if (isCredentialProviderAvailable) {
+      URL keystoreUrl = ClientContextTest.class.getResource(keystoreName);
+
+      Assert.assertNotNull("Could not find " + keystoreName, keystoreUrl);
+
+      keystore = new File(keystoreUrl.getFile());
+    }
+  }
+
+  protected String getKeyStoreUrl(File absoluteFilePath) {
+    return "jceks://file" + absoluteFilePath.getAbsolutePath();
+  }
+
+  @Test
+  public void loadSensitivePropertyFromCredentialProvider() {
+    if (!isCredentialProviderAvailable) {
+      return;
+    }
+
+    String absPath = getKeyStoreUrl(keystore);
+    ClientConfiguration clientConf = new ClientConfiguration();
+    clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath);
+
+    AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf);
+    Assert.assertEquals("mysecret", accClientConf.get(Property.INSTANCE_SECRET));
+  }
+
+  @Test
+  public void defaultValueForSensitiveProperty() {
+    if (!isCredentialProviderAvailable) {
+      return;
+    }
+
+    ClientConfiguration clientConf = new ClientConfiguration();
+
+    AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf);
+    Assert.assertEquals(Property.INSTANCE_SECRET.getDefaultValue(), accClientConf.get(Property.INSTANCE_SECRET));
+  }
+
+  @Test
+  public void sensitivePropertiesIncludedInProperties() {
+    if (!isCredentialProviderAvailable) {
+      return;
+    }
+
+    String absPath = getKeyStoreUrl(keystore);
+    ClientConfiguration clientConf = new ClientConfiguration();
+    clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath);
+
+    AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf);
+    Map<String,String> props = new HashMap<String,String>();
+    accClientConf.getProperties(props, new AllFilter());
+
+    // Only sensitive properties are added
+    Assert.assertEquals(Property.GENERAL_RPC_TIMEOUT.getDefaultValue(), props.get(Property.GENERAL_RPC_TIMEOUT.getKey()));
+    // Only known properties are added
+    Assert.assertFalse(props.containsKey("ignored.property"));
+    Assert.assertEquals("mysecret", props.get(Property.INSTANCE_SECRET.getKey()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/test/java/org/apache/accumulo/core/client/impl/RootTabletLocatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/RootTabletLocatorTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/RootTabletLocatorTest.java
index b7be982..b55e004 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/RootTabletLocatorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/RootTabletLocatorTest.java
@@ -16,6 +16,11 @@
  */
 package org.apache.accumulo.core.client.impl;
 
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.TabletLocatorImpl.TabletServerLockChecker;
@@ -24,10 +29,6 @@ import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
 import org.junit.Before;
 import org.junit.Test;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 
 public class RootTabletLocatorTest {
   private Instance instance;
@@ -46,7 +47,7 @@ public class RootTabletLocatorTest {
     lockChecker = createMock(TabletServerLockChecker.class);
     zcf = createMock(ZooCacheFactory.class);
     zc = createMock(ZooCache.class);
-    rtl = new RootTabletLocator(instance, lockChecker, zcf);
+    rtl = new RootTabletLocator(lockChecker, zcf);
   }
 
   @Test
@@ -55,7 +56,7 @@ public class RootTabletLocatorTest {
     replay(zcf);
     zc.clear(ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/server");
     replay(zc);
-    rtl.invalidateCache("server");
+    rtl.invalidateCache(instance, "server");
     verify(zc);
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
index 311bbf8..be4d467 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.core.client.impl;
 
+import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -32,7 +33,8 @@ public class ScannerImplTest {
   @Test
   public void testValidReadaheadValues() {
     MockInstance instance = new MockInstance();
-    Scanner s = new ScannerImpl(instance, new Credentials("root", new PasswordToken("")), "foo", new Authorizations());
+    ClientContext context = new ClientContext(instance, new Credentials("root", new PasswordToken("")), new ClientConfiguration());
+    Scanner s = new ScannerImpl(context, "foo", Authorizations.EMPTY);
     s.setReadaheadThreshold(0);
     s.setReadaheadThreshold(10);
     s.setReadaheadThreshold(Long.MAX_VALUE);
@@ -43,7 +45,8 @@ public class ScannerImplTest {
   @Test(expected = IllegalArgumentException.class)
   public void testInValidReadaheadValues() {
     MockInstance instance = new MockInstance();
-    Scanner s = new ScannerImpl(instance, new Credentials("root", new PasswordToken("")), "foo", new Authorizations());
+    ClientContext context = new ClientContext(instance, new Credentials("root", new PasswordToken("")), new ClientConfiguration());
+    Scanner s = new ScannerImpl(context, "foo", Authorizations.EMPTY);
     s.setReadaheadThreshold(-1);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java
index 20e068b..73a9024 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.client.impl;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
@@ -39,7 +40,8 @@ public class TableOperationsImplTest {
     Instance instance = EasyMock.createMock(Instance.class);
     Credentials credentials = EasyMock.createMock(Credentials.class);
 
-    TableOperationsImpl topsImpl = new TableOperationsImpl(instance, credentials);
+    ClientContext context = new ClientContext(instance, credentials, new ClientConfiguration());
+    TableOperationsImpl topsImpl = new TableOperationsImpl(context);
 
     Connector connector = EasyMock.createMock(Connector.class);
     Scanner scanner = EasyMock.createMock(Scanner.class);
@@ -78,7 +80,7 @@ public class TableOperationsImplTest {
 
     EasyMock.replay(instance, credentials, connector, scanner);
 
-    topsImpl.createMetadataScanner(instance, credentials, tableName, range);
+    topsImpl.createMetadataScanner(tableName, range);
 
     EasyMock.verify(instance, credentials, connector, scanner);
   }


Mime
View raw message