private void checkOffline(ClientContext context) throws Exception { if (Tables.getTableState(context, tableInfo.tableID) != TableState.OFFLINE) { Tables.clearCache(context); if (Tables.getTableState(context, tableInfo.tableID) != TableState.OFFLINE) { throw new AcceptableThriftTableOperationException(tableInfo.tableID.canonicalID(), tableInfo.tableName, TableOperation.EXPORT, TableOperationExceptionType.OTHER, "Table is not offline"); } } }
/** * Retrieve the credentials used to construct this context */ public synchronized Credentials getCredentials() { ensureOpen(); if (creds == null) { creds = new Credentials(info.getPrincipal(), info.getAuthenticationToken()); } return creds; }
public static void checkNamespaceDoesNotExist(ServerContext context, String namespace, Namespace.ID namespaceId, TableOperation operation) throws AcceptableThriftTableOperationException { Namespace.ID n = Namespaces.lookupNamespaceId(context, namespace); if (n != null && !n.equals(namespaceId)) throw new AcceptableThriftTableOperationException(null, namespace, operation, TableOperationExceptionType.NAMESPACE_EXISTS, null); }
public static String getTableOfflineMsg(ClientContext context, Table.ID tableId) { if (tableId == null) return "Table <unknown table> is offline"; try { String tableName = Tables.getTableName(context, tableId); return "Table " + tableName + " (" + tableId.canonicalID() + ") is offline"; } catch (TableNotFoundException e) { return "Table <unknown table> (" + tableId.canonicalID() + ") is offline"; } }
@Override public String whoami() { ensureOpen(); return getCredentials().getPrincipal(); }
/** * Returns the instance name given at system initialization time. * * @return current instance name */ public String getInstanceName() { ensureOpen(); return info.getInstanceName(); }
@Override public void invalidateCache(ClientContext context, String server) { syncLocator().invalidateCache(context, server); } }
/** * Returns the zookeeper connection timeout. * * @return the configured timeout to connect to zookeeper */ public int getZooKeepersSessionTimeOut() { ensureOpen(); return info.getZooKeepersSessionTimeOut(); }
@Override public TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return syncLocator().locateTablet(context, row, skipRow, retry); }
@Override public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException { ensureOpen(); return new ConditionalWriterImpl(this, getTableId(tableName), config); }
@Override public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return syncLocator().binRanges(context, ranges, binnedRanges); }
/** * Returns a comma-separated list of zookeeper servers the instance is using. * * @return the zookeeper servers this instance is using in "hostname:port" form */ public String getZooKeepers() { ensureOpen(); return info.getZooKeepers(); }
/** * Add mutations that previously failed back into the mix */ private synchronized void addFailedMutations(MutationSet failedMutations) { mutations.addAll(failedMutations); if (mutations.getMemoryUsed() >= maxMem / 2 || closed || flushing) { startProcessing(); } }
@Override public FromOptions<T> from(String propertiesFilePath) { return from(ClientInfoImpl.toProperties(propertiesFilePath)); }
@Override public synchronized ReplicationOperations replicationOperations() { ensureOpen(); if (replicationops == null) { replicationops = new ReplicationOperationsImpl(this); } return replicationops; }
@Override public synchronized SecurityOperations securityOperations() { ensureOpen(); if (secops == null) secops = new SecurityOperationsImpl(this); return secops; }
@Override public synchronized InstanceOperations instanceOperations() { ensureOpen(); if (instanceops == null) instanceops = new InstanceOperationsImpl(this); return instanceops; }
@Override public <T extends Mutation> void binMutations(ClientContext context, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { syncLocator().binMutations(context, mutations, binnedMutations, failures); }
public TTransport getTransport(HostAndPort location, long milliseconds, ClientContext context) throws TTransportException { return getTransport(new ThriftTransportKey(location, milliseconds, context)); }
public static Pair<String,ClientService.Client> getConnection(ClientContext context, boolean preferCachedConnections) throws TTransportException { return getConnection(context, preferCachedConnections, context.getClientTimeoutInMillis()); }