本文整理了Java中org.apache.accumulo.core.client.Connector.getInstance()
方法的一些代码示例,展示了Connector.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.getInstance()
方法的具体详情如下:
包路径:org.apache.accumulo.core.client.Connector
类名称:Connector
方法名:getInstance
[英]Accessor method for internal instance object.
[中]内部实例对象的访问器方法。
代码示例来源:origin: prestodb/presto
public static synchronized DistributedQueryRunner createAccumuloQueryRunner(Map<String, String> extraProperties)
throws Exception
{
DistributedQueryRunner queryRunner =
new DistributedQueryRunner(createSession(), 4, extraProperties);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
queryRunner.installPlugin(new AccumuloPlugin());
Map<String, String> accumuloProperties =
ImmutableMap.<String, String>builder()
.put(AccumuloConfig.INSTANCE, connector.getInstance().getInstanceName())
.put(AccumuloConfig.ZOOKEEPERS, connector.getInstance().getZooKeepers())
.put(AccumuloConfig.USERNAME, MAC_USER)
.put(AccumuloConfig.PASSWORD, MAC_PASSWORD)
.put(AccumuloConfig.ZOOKEEPER_METADATA_ROOT, "/presto-accumulo-test")
.build();
queryRunner.createCatalog("accumulo", "accumulo", accumuloProperties);
if (!tpchLoaded) {
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), TpchTable.getTables());
connector.tableOperations().addSplits("tpch.orders", ImmutableSortedSet.of(new Text(new LexicoderRowSerializer().encode(BIGINT, 7500L))));
tpchLoaded = true;
}
return queryRunner;
}
代码示例来源:origin: prestodb/presto
public TestAccumuloClient()
throws Exception
{
AccumuloConfig config = new AccumuloConfig()
.setUsername("root")
.setPassword("secret");
Connector connector = AccumuloQueryRunner.getAccumuloConnector();
config.setZooKeepers(connector.getInstance().getZooKeepers());
zooKeeperMetadataManager = new ZooKeeperMetadataManager(config, new TypeRegistry());
client = new AccumuloClient(connector, config, zooKeeperMetadataManager, new AccumuloTableManager(connector), new IndexLookup(connector, new ColumnCardinalityCache(connector, config)));
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
public static boolean isOnline(Connector conn) {
return DeprecationUtil.isMockInstance(conn.getInstance())
|| TableState.ONLINE == Tables.getTableState(conn.getInstance(), ID);
}
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public boolean equals(Object obj) {
if (obj instanceof AccumuloLoader) {
AccumuloLoader loaderObj = AccumuloLoader.class.cast(obj);
if (connector.getInstance().getInstanceID().equals(loaderObj.connector.getInstance().getInstanceID())) {
if (tableName.equals(loaderObj.tableName))
return true;
}
}
return false;
}
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public String toString() {
return new StringBuilder().append(instance.getInstanceID()).append("/").append(connector.getInstance().getInstanceName()).append("/").append("/")
.append(table).append("/").append(user).toString();
}
代码示例来源:origin: org.apache.accumulo/accumulo-master
private void checkOffline(Connector conn) throws Exception {
if (Tables.getTableState(conn.getInstance(), tableInfo.tableID) != TableState.OFFLINE) {
Tables.clearCache(conn.getInstance());
if (Tables.getTableState(conn.getInstance(), tableInfo.tableID) != TableState.OFFLINE) {
throw new AcceptableThriftTableOperationException(tableInfo.tableID, tableInfo.tableName,
TableOperation.EXPORT, TableOperationExceptionType.OTHER, "Table is not offline");
}
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private void checkOffline(Connector conn) throws Exception {
if (Tables.getTableState(conn.getInstance(), tableInfo.tableID) != TableState.OFFLINE) {
Tables.clearCache(conn.getInstance());
if (Tables.getTableState(conn.getInstance(), tableInfo.tableID) != TableState.OFFLINE) {
throw new ThriftTableOperationException(tableInfo.tableID, tableInfo.tableName, TableOperation.EXPORT, TableOperationExceptionType.OTHER,
"Table is not offline");
}
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
private Map<String,Boolean> _getWals(Connector c) throws Exception {
Map<String,Boolean> result = new HashMap<>();
Instance i = c.getInstance();
ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
"");
WalStateManager wals = new WalStateManager(c.getInstance(), zk);
for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
// WALs are in use if they are not unreferenced
result.put(entry.getKey().toString(), entry.getValue() != WalState.UNREFERENCED);
}
return result;
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
public static IteratorSetting iteratorSetting(int priority, int sleepAfterFirstWrite,
long batchWriterTimeout, long batchWriterMaxMemory, int numEntriesToWrite, String tableName,
Connector connector, AuthenticationToken token, boolean clearCacheAfterFirstWrite,
boolean splitAfterFirstWrite) {
return iteratorSetting(priority, sleepAfterFirstWrite, batchWriterTimeout, batchWriterMaxMemory,
numEntriesToWrite, tableName, connector.getInstance().getZooKeepers(),
connector.getInstance().getInstanceName(),
connector.getInstance().getZooKeepersSessionTimeOut(), connector.whoami(), token,
clearCacheAfterFirstWrite, splitAfterFirstWrite);
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public void run() {
try {
CacheTestReader.main(new String[] {pathName, testDir.getAbsolutePath(),
getConnector().getInstance().getZooKeepers()});
} catch (Exception ex) {
ref.set(ex);
}
}
};
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public boolean apply(String tableId) {
return Tables.getTableState(getConnector().getInstance(), tableId) == TableState.ONLINE;
}
});
代码示例来源:origin: org.apache.accumulo/accumulo-shell
public void printInfo() throws IOException {
reader.print("\n" + SHELL_DESCRIPTION + "\n" + "- \n" + "- version: " + Constants.VERSION + "\n"
+ "- instance name: " + connector.getInstance().getInstanceName() + "\n" + "- instance id: "
+ connector.getInstance().getInstanceID() + "\n" + "- \n"
+ "- type 'help' for a list of available commands\n" + "- \n");
reader.flush();
}
代码示例来源:origin: org.apache.accumulo/accumulo-master
/**
* Initialize the DistributedWorkQueue using the proper ZK location
*/
protected void initializeWorkQueue(AccumuloConfiguration conf) {
workQueue = new DistributedWorkQueue(
ZooUtil.getRoot(conn.getInstance()) + ReplicationConstants.ZOO_WORK_QUEUE, conf);
}
代码示例来源:origin: Accla/graphulo
/**
* Check authenticationToken works for this user.
*/
private void checkCredentials() {
try {
if (!connector.securityOperations().authenticateUser(connector.whoami(), authenticationToken))
throw new IllegalArgumentException("instance " + connector.getInstance().getInstanceName() + ": bad username " + connector.whoami() + " with token " + authenticationToken);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new IllegalArgumentException("instance " + connector.getInstance().getInstanceName() + ": error with username " + connector.whoami() + " with token " + authenticationToken, e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Test(expected = RuntimeException.class)
public void invalidInstanceName() throws Exception {
final Connector conn = getConnector();
new ZooKeeperInstance("fake_instance_name", conn.getInstance().getZooKeepers());
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@After
public void checkForDanglingFateLocks() {
FunctionalTestUtils.assertNoDanglingFateLocks(getConnector().getInstance(), getCluster());
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
private long getSyncs() throws Exception {
Connector c = getConnector();
ServerConfigurationFactory confFactory = new ServerConfigurationFactory(c.getInstance());
AccumuloServerContext context = new AccumuloServerContext(confFactory);
for (String address : c.instanceOperations().getTabletServers()) {
TabletClientService.Client client = ThriftUtil
.getTServerClient(HostAndPort.fromString(address), context);
TabletServerStatus status = client.getTabletServerStatus(null, context.rpcCreds());
return status.syncs;
}
return 0;
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
public MultiTableBatchWriter getMultiTableBatchWriter() {
ClientContext context = new ClientContext(connector.getInstance(),
new Credentials(getAdminPrincipal(), getAdminToken()), getCluster().getClientConfig());
return new MultiTableBatchWriterImpl(context, new BatchWriterConfig());
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
private TabletLocationState getTabletLocationState(Connector c, String tableId)
throws FileNotFoundException, ConfigurationException {
Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
ClientContext context = new ClientContext(c.getInstance(), creds,
getCluster().getClientConfig());
MetaDataTableScanner s = new MetaDataTableScanner(context,
new Range(KeyExtent.getMetadataEntry(tableId, null)));
TabletLocationState tlState = s.next();
s.close();
return tlState;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Before
public void configureInstance() throws Exception {
conn = getConnector();
inst = conn.getInstance();
ReplicationTable.setOnline(conn);
conn.securityOperations().grantTablePermission(conn.whoami(), MetadataTable.NAME,
TablePermission.WRITE);
conn.securityOperations().grantTablePermission(conn.whoami(), ReplicationTable.NAME,
TablePermission.READ);
conn.securityOperations().grantTablePermission(conn.whoami(), ReplicationTable.NAME,
TablePermission.WRITE);
}
内容来源于网络,如有侵权,请联系作者删除!