accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/9] git commit: ACCUMULO-2408 organize static final members of abstract class to a concrete implementation
Date Wed, 26 Feb 2014 19:40:55 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master ada62bacb -> 66998005c


ACCUMULO-2408 organize static final members of abstract class to a concrete implementation


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

Branch: refs/heads/master
Commit: 57b2e5c7751e2df03b65db6decdb932ba8394802
Parents: 1543d65
Author: Eric Newton <eric.newton@gmail.com>
Authored: Wed Feb 26 14:20:05 2014 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Wed Feb 26 14:20:05 2014 -0500

----------------------------------------------------------------------
 .../impl/TabletServerBatchReaderIterator.java   | 12 +++----
 .../client/impl/TabletServerBatchWriter.java    |  6 ++--
 .../core/client/impl/ThriftScanner.java         |  4 +--
 .../accumulo/core/client/impl/Translator.java   |  9 -----
 .../accumulo/core/client/impl/Translators.java  | 37 ++++++++++++++++++++
 .../accumulo/server/client/BulkImporter.java    |  5 +--
 .../server/tabletserver/TabletServer.java       | 17 ++++-----
 .../mastermessage/SplitReportMessage.java       |  3 +-
 8 files changed, 62 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
b/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index bc98cf1..d4df543 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
@@ -481,13 +481,13 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
   static void trackScanning(Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>>
unscanned, MultiScanResult scanResult) {
     
     // translate returned failures, remove them from unscanned, and add them to failures
-    Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures,
Translator.TKET, new Translator.ListTranslator<TRange,Range>(
-        Translator.TRT));
+    Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures,
Translators.TKET, new Translator.ListTranslator<TRange,Range>(
+        Translators.TRT));
     unscanned.keySet().removeAll(retFailures.keySet());
     failures.putAll(retFailures);
     
     // translate full scans and remove them from unscanned
-    HashSet<KeyExtent> fullScans = new HashSet<KeyExtent>(Translator.translate(scanResult.fullScans,
Translator.TKET));
+    HashSet<KeyExtent> fullScans = new HashSet<KeyExtent>(Translator.translate(scanResult.fullScans,
Translators.TKET));
     unscanned.keySet().removeAll(fullScans);
     
     // remove partial scan from unscanned
@@ -537,9 +537,9 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
         TabletType ttype = TabletType.type(requested.keySet());
         boolean waitForWrites = !ThriftScanner.serversWaitedForWrites.get(ttype).contains(server);
         
-        Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested,
Translator.KET, new Translator.ListTranslator<Range,TRange>(
-            Translator.RT));
-        InitialMultiScan imsr = client.startMultiScan(null, credentials, thriftTabletRanges,
Translator.translate(columns, Translator.CT),
+        Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested,
Translators.KET, new Translator.ListTranslator<Range,TRange>(
+            Translators.RT));
+        InitialMultiScan imsr = client.startMultiScan(null, credentials, thriftTabletRanges,
Translator.translate(columns, Translators.CT),
             options.serverSideIteratorList, options.serverSideIteratorOptions, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()),
waitForWrites);
         if (waitForWrites)
           ThriftScanner.serversWaitedForWrites.get(ttype).add(server);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
b/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
index e18f3f9..81f1298 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
@@ -772,9 +772,9 @@ public class TabletServerBatchWriter {
           }
           
           UpdateErrors updateErrors = client.closeUpdate(null, usid);
-          Map<KeyExtent,Long> failures = Translator.translate(updateErrors.failedExtents,
Translator.TKET);
-          updatedConstraintViolations(Translator.translate(updateErrors.violationSummaries,
Translator.TCVST));
-          updateAuthorizationFailures(Translator.translate(updateErrors.authorizationFailures,
Translator.TKET));
+          Map<KeyExtent,Long> failures = Translator.translate(updateErrors.failedExtents,
Translators.TKET);
+          updatedConstraintViolations(Translator.translate(updateErrors.violationSummaries,
Translators.TCVST));
+          updateAuthorizationFailures(Translator.translate(updateErrors.authorizationFailures,
Translators.TKET));
           
           for (Entry<KeyExtent,Long> entry : failures.entrySet()) {
             KeyExtent failedExtent = entry.getKey();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
b/src/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
index e57832b..6622959 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
@@ -126,7 +126,7 @@ public class ThriftScanner {
         TabletType ttype = TabletType.type(extent);
         boolean waitForWrites = !serversWaitedForWrites.get(ttype).contains(server);
         InitialScan isr = client.startScan(null, scanState.credentials, extent.toThrift(),
scanState.range.toThrift(),
-            Translator.translate(scanState.columns, Translator.CT), scanState.size, scanState.serverSideIteratorList,
scanState.serverSideIteratorOptions,
+            Translator.translate(scanState.columns, Translators.CT), scanState.size, scanState.serverSideIteratorList,
scanState.serverSideIteratorOptions,
             scanState.authorizations.getAuthorizationsBB(), waitForWrites, scanState.isolated);
         if (waitForWrites)
           serversWaitedForWrites.get(ttype).add(server);
@@ -413,7 +413,7 @@ public class ThriftScanner {
         TabletType ttype = TabletType.type(loc.tablet_extent);
         boolean waitForWrites = !serversWaitedForWrites.get(ttype).contains(loc.tablet_location);
         InitialScan is = client.startScan(null, scanState.credentials, loc.tablet_extent.toThrift(),
scanState.range.toThrift(),
-            Translator.translate(scanState.columns, Translator.CT), scanState.size, scanState.serverSideIteratorList,
scanState.serverSideIteratorOptions,
+            Translator.translate(scanState.columns, Translators.CT), scanState.size, scanState.serverSideIteratorList,
scanState.serverSideIteratorOptions,
             scanState.authorizations.getAuthorizationsBB(), waitForWrites, scanState.isolated);
         if (waitForWrites)
           serversWaitedForWrites.get(ttype).add(loc.tablet_location);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java b/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
index aa5a3be..103199b 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
@@ -103,15 +103,6 @@ public abstract class Translator<IT,OT> {
     
   }
   
-  public static final TKeyExtentTranslator TKET = new TKeyExtentTranslator();
-  public static final TCVSTranslator TCVST = new TCVSTranslator();
-  public static final TRangeTranslator TRT = new TRangeTranslator();
-  
-  public static final KeyExtentTranslator KET = new KeyExtentTranslator();
-  public static final ColumnTranslator CT = new ColumnTranslator();
-  public static final Translator<Range,TRange> RT = new RangeTranslator();
-  public static final CVSTranslator CVST = new CVSTranslator();
-  
   public static <IKT,OKT,T> Map<OKT,T> translate(Map<IKT,T> input, Translator<IKT,OKT>
keyTranslator) {
     HashMap<OKT,T> output = new HashMap<OKT,T>();
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translators.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translators.java
b/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translators.java
new file mode 100644
index 0000000..c433ae7
--- /dev/null
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/impl/Translators.java
@@ -0,0 +1,37 @@
+/*
+ * 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 org.apache.accumulo.core.client.impl.Translator.CVSTranslator;
+import org.apache.accumulo.core.client.impl.Translator.ColumnTranslator;
+import org.apache.accumulo.core.client.impl.Translator.KeyExtentTranslator;
+import org.apache.accumulo.core.client.impl.Translator.RangeTranslator;
+import org.apache.accumulo.core.client.impl.Translator.TCVSTranslator;
+import org.apache.accumulo.core.client.impl.Translator.TKeyExtentTranslator;
+import org.apache.accumulo.core.client.impl.Translator.TRangeTranslator;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.thrift.TRange;
+
+public class Translators {
+  public static final TKeyExtentTranslator TKET = new TKeyExtentTranslator();
+  public static final TCVSTranslator TCVST = new TCVSTranslator();
+  public static final TRangeTranslator TRT = new TRangeTranslator();
+  public static final KeyExtentTranslator KET = new KeyExtentTranslator();
+  public static final ColumnTranslator CT = new ColumnTranslator();
+  public static final Translator<Range,TRange> RT = new RangeTranslator();
+  public static final CVSTranslator CVST = new CVSTranslator();
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
b/src/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index 3c0cd99..19ae765 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -41,6 +41,7 @@ import org.apache.accumulo.core.client.impl.ServerClient;
 import org.apache.accumulo.core.client.impl.TabletLocator;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation;
 import org.apache.accumulo.core.client.impl.Translator;
+import org.apache.accumulo.core.client.impl.Translators;
 import org.apache.accumulo.core.client.impl.thrift.ClientService;
 import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -591,9 +592,9 @@ public class BulkImporter {
         }
         
         log.debug("Asking " + location + " to bulk load " + files);
-        List<TKeyExtent> failures = client.bulkImport(null, credentials, tid, Translator.translate(files,
Translator.KET), setTime);
+        List<TKeyExtent> failures = client.bulkImport(null, credentials, tid, Translator.translate(files,
Translators.KET), setTime);
         
-        return Translator.translate(failures, Translator.TKET);
+        return Translator.translate(failures, Translators.TKET);
       } finally {
         ThriftUtil.returnClient((TServiceClient) client);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
index ff4f1bc..7997013 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
@@ -73,6 +73,7 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.impl.TabletType;
 import org.apache.accumulo.core.client.impl.Translator;
+import org.apache.accumulo.core.client.impl.Translators;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.constraints.Constraint.Environment;
@@ -525,7 +526,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
           }
 
           activeScans.add(new ActiveScan(ss.client, ss.user, ss.extent.getTableId().toString(),
ct - ss.startTime, ct - ss.lastAccessTime, ScanType.SINGLE,
-              state, ss.extent.toThrift(), Translator.translate(ss.columnSet, Translator.CT),
ss.ssiList, ss.ssio));
+              state, ss.extent.toThrift(), Translator.translate(ss.columnSet, Translators.CT),
ss.ssiList, ss.ssio));
 
         } else if (session instanceof MultiScanSession) {
           MultiScanSession mss = (MultiScanSession) session;
@@ -549,7 +550,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
           }
 
           activeScans.add(new ActiveScan(mss.client, mss.user, mss.threadPoolExtent.getTableId().toString(),
ct - mss.startTime, ct - mss.lastAccessTime,
-              ScanType.BATCH, state, mss.threadPoolExtent.toThrift(), Translator.translate(mss.columnSet,
Translator.CT), mss.ssiList, mss.ssio));
+              ScanType.BATCH, state, mss.threadPoolExtent.toThrift(), Translator.translate(mss.columnSet,
Translators.CT), mss.ssiList, mss.ssio));
         }
       }
 
@@ -1046,8 +1047,8 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
           List<TKeyValue> retResults = new ArrayList<TKeyValue>();
           for (KVEntry entry : results)
             retResults.add(new TKeyValue(entry.key.toThrift(), ByteBuffer.wrap(entry.value)));
-          Map<TKeyExtent,List<TRange>> retFailures = Translator.translate(failures,
Translator.KET, new Translator.ListTranslator<Range,TRange>(Translator.RT));
-          List<TKeyExtent> retFullScans = Translator.translate(fullScans, Translator.KET);
+          Map<TKeyExtent,List<TRange>> retFailures = Translator.translate(failures,
Translators.KET, new Translator.ListTranslator<Range,TRange>(Translators.RT));
+          List<TKeyExtent> retFullScans = Translator.translate(fullScans, Translators.KET);
           TKeyExtent retPartScan = null;
           TKey retPartNextKey = null;
           if (partScan != null) {
@@ -1254,7 +1255,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
 
       KeyExtent threadPoolExtent = null;
 
-      Map<KeyExtent,List<Range>> batch = Translator.translate(tbatch, Translator.TKET,
new Translator.ListTranslator<TRange,Range>(Translator.TRT));
+      Map<KeyExtent,List<Range>> batch = Translator.translate(tbatch, Translators.TKET,
new Translator.ListTranslator<TRange,Range>(Translators.TRT));
 
       for (KeyExtent keyExtent : batch.keySet()) {
         if (threadPoolExtent == null) {
@@ -1635,8 +1636,8 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
         log.debug(String.format("Authentication Failures: %d, first %s", us.authFailures.size(),
first.toString()));
       }
 
-      return new UpdateErrors(Translator.translate(us.failures, Translator.KET), Translator.translate(violations,
Translator.CVST), Translator.translate(
-          us.authFailures, Translator.KET));
+      return new UpdateErrors(Translator.translate(us.failures, Translators.KET), Translator.translate(violations,
Translators.CVST), Translator.translate(
+          us.authFailures, Translators.KET));
     }
 
     @Override
@@ -1686,7 +1687,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
         cs.commit(mutations);
         commit.stop();
       } catch (TConstraintViolationException e) {
-        throw new ConstraintViolationException(Translator.translate(e.getViolations().asList(),
Translator.CVST));
+        throw new ConstraintViolationException(Translator.translate(e.getViolations().asList(),
Translators.CVST));
       } finally {
         writeTracker.finishWrite(opid);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/57b2e5c7/src/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
index 05f1d81..63b9bcc 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.accumulo.core.client.impl.Translator;
+import org.apache.accumulo.core.client.impl.Translators;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.master.thrift.MasterClientService;
 import org.apache.accumulo.core.master.thrift.TabletSplit;
@@ -47,7 +48,7 @@ public class SplitReportMessage implements MasterMessage {
   public void send(AuthInfo credentials, String serverName, MasterClientService.Iface client)
throws TException, ThriftSecurityException {
     TabletSplit split = new TabletSplit();
     split.oldTablet = old_extent.toThrift();
-    split.newTablets = Translator.translate(extents.keySet(), Translator.KET);
+    split.newTablets = Translator.translate(extents.keySet(), Translators.KET);
     client.reportSplitExtent(null, credentials, serverName, split);
   }
   


Mime
View raw message