Search in sources :

Example 6 with Client

use of org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client in project accumulo by apache.

the class InstanceOperationsImpl method getActiveScans.

@Override
public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException, AccumuloSecurityException {
    final HostAndPort parsedTserver = HostAndPort.fromString(tserver);
    Client client = null;
    try {
        client = ThriftUtil.getTServerClient(parsedTserver, context);
        List<ActiveScan> as = new ArrayList<>();
        for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(), context.rpcCreds())) {
            try {
                as.add(new ActiveScanImpl(context.getInstance(), 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);
    }
}
Also used : TException(org.apache.thrift.TException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) ActiveScan(org.apache.accumulo.core.client.admin.ActiveScan) ArrayList(java.util.ArrayList) TTransportException(org.apache.thrift.transport.TTransportException) ThriftSecurityException(org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException) HostAndPort(org.apache.accumulo.core.util.HostAndPort) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) Client(org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client)

Example 7 with Client

use of org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client in project accumulo by apache.

the class InstanceOperationsImpl method ping.

@Override
public void ping(String tserver) throws AccumuloException {
    TTransport transport = null;
    try {
        transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), context);
        TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
        client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds());
    } catch (TException e) {
        throw new AccumuloException(e);
    } finally {
        if (transport != null) {
            transport.close();
        }
    }
}
Also used : TException(org.apache.thrift.TException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) Client(org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client) TTransport(org.apache.thrift.transport.TTransport) TabletClientService(org.apache.accumulo.core.tabletserver.thrift.TabletClientService) Client(org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client)

Aggregations

Client (org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client)7 HostAndPort (org.apache.accumulo.core.util.HostAndPort)5 AccumuloException (org.apache.accumulo.core.client.AccumuloException)3 MasterClient (org.apache.accumulo.core.client.impl.MasterClient)3 TException (org.apache.thrift.TException)3 TTransportException (org.apache.thrift.transport.TTransportException)3 UnknownHostException (java.net.UnknownHostException)2 ArrayList (java.util.ArrayList)2 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)2 Connector (org.apache.accumulo.core.client.Connector)2 ThriftSecurityException (org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException)2 KeeperException (org.apache.zookeeper.KeeperException)2 List (java.util.List)1 Entry (java.util.Map.Entry)1 BatchWriter (org.apache.accumulo.core.client.BatchWriter)1 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)1 ActiveCompaction (org.apache.accumulo.core.client.admin.ActiveCompaction)1 ActiveScan (org.apache.accumulo.core.client.admin.ActiveScan)1 ClientContext (org.apache.accumulo.core.client.impl.ClientContext)1 Credentials (org.apache.accumulo.core.client.impl.Credentials)1