accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1437054 - /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
Date Tue, 22 Jan 2013 17:18:10 GMT
Author: kturner
Date: Tue Jan 22 17:18:10 2013
New Revision: 1437054

URL: http://svn.apache.org/viewvc?rev=1437054&view=rev
Log:
ACCUMULO-977 modified listscans and listcompactions to not retry on a bad tserver

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java?rev=1437054&r1=1437053&r2=1437054&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
Tue Jan 22 17:18:10 2013
@@ -36,7 +36,6 @@ import org.apache.accumulo.core.client.i
 import org.apache.accumulo.core.master.thrift.MasterClientService;
 import org.apache.accumulo.core.security.thrift.AuthInfo;
 import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ThriftUtil;
@@ -147,22 +146,29 @@ public class InstanceOperationsImpl impl
   
   @Override
   public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException,
AccumuloSecurityException {
-    List<org.apache.accumulo.core.tabletserver.thrift.ActiveScan> tas = ThriftUtil.execute(tserver,
instance.getConfiguration(),
-        new ClientExecReturn<List<org.apache.accumulo.core.tabletserver.thrift.ActiveScan>,TabletClientService.Client>()
{
-          @Override
-          public List<org.apache.accumulo.core.tabletserver.thrift.ActiveScan> execute(TabletClientService.Client
client) throws Exception {
-            return client.getActiveScans(Tracer.traceInfo(), credentials);
-          }
-        });
-    List<ActiveScan> as = new ArrayList<ActiveScan>();
-    for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : tas) {
-      try {
-        as.add(new ActiveScan(instance, activeScan));
-      } catch (TableNotFoundException e) {
-        throw new AccumuloException(e);
+    Client client = null;
+    try {
+      client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
+      
+      List<ActiveScan> as = new ArrayList<ActiveScan>();
+      for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(),
credentials)) {
+        try {
+          as.add(new ActiveScan(instance, activeScan));
+        } catch (TableNotFoundException e) {
+          throw new AccumuloException(e);
+        }
       }
+      return as;
+    } catch (TTransportException e) {
+      throw new AccumuloException(e);
+    } catch (ThriftSecurityException e) {
+      throw new AccumuloSecurityException(e.user, e.code, e);
+    } catch (TException e) {
+      throw new AccumuloException(e);
+    } finally {
+      if (client != null)
+        ThriftUtil.returnClient(client);
     }
-    return as;
   }
   
   /* (non-Javadoc)
@@ -185,18 +191,25 @@ public class InstanceOperationsImpl impl
    */
   @Override
   public List<ActiveCompaction> getActiveCompactions(String tserver) throws AccumuloException,
AccumuloSecurityException {
-    List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> tas = ThriftUtil.execute(tserver,
instance.getConfiguration(),
-        new ClientExecReturn<List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>,TabletClientService.Client>()
{
-          @Override
-          public List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>
execute(TabletClientService.Client client) throws Exception {
-            return client.getActiveCompactions(Tracer.traceInfo(), credentials);
-          }
-        });
-    List<ActiveCompaction> as = new ArrayList<ActiveCompaction>();
-    for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction :
tas) {
-      as.add(new ActiveCompaction(instance, activeCompaction));
+    Client client = null;
+    try {
+      client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
+      
+      List<ActiveCompaction> as = new ArrayList<ActiveCompaction>();
+      for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction
: client.getActiveCompactions(Tracer.traceInfo(), credentials)) {
+        as.add(new ActiveCompaction(instance, activeCompaction));
+      }
+      return as;
+    } catch (TTransportException e) {
+      throw new AccumuloException(e);
+    } catch (ThriftSecurityException e) {
+      throw new AccumuloSecurityException(e.user, e.code, e);
+    } catch (TException e) {
+      throw new AccumuloException(e);
+    } finally {
+      if (client != null)
+        ThriftUtil.returnClient(client);
     }
-    return as;
   }
   
   /*



Mime
View raw message