use of org.apache.accumulo.core.metadata.MetadataLocationObtainer in project accumulo by apache.
the class TabletLocator method getLocator.
public static synchronized TabletLocator getLocator(ClientContext context, Table.ID tableId) {
Instance instance = context.getInstance();
LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId);
TabletLocator tl = locators.get(key);
if (tl == null) {
MetadataLocationObtainer mlo = new MetadataLocationObtainer();
if (RootTable.ID.equals(tableId)) {
tl = new RootTabletLocator(new ZookeeperLockChecker(instance));
} else if (MetadataTable.ID.equals(tableId)) {
tl = new TabletLocatorImpl(MetadataTable.ID, getLocator(context, RootTable.ID), mlo, new ZookeeperLockChecker(instance));
} else {
tl = new TabletLocatorImpl(tableId, getLocator(context, MetadataTable.ID), mlo, new ZookeeperLockChecker(instance));
}
locators.put(key, tl);
}
return tl;
}
use of org.apache.accumulo.core.metadata.MetadataLocationObtainer in project accumulo by apache.
the class TabletLocator method getLocator.
public static synchronized TabletLocator getLocator(ClientContext context, TableId tableId) {
Preconditions.checkState(enabled, "The Accumulo singleton that that tracks tablet locations is " + "disabled. This is likely caused by all AccumuloClients being closed or garbage collected");
LocatorKey key = new LocatorKey(context.getInstanceID(), tableId);
TabletLocator tl = locators.get(key);
if (tl == null) {
MetadataLocationObtainer mlo = new MetadataLocationObtainer();
if (RootTable.ID.equals(tableId)) {
tl = new RootTabletLocator(new ZookeeperLockChecker(context));
} else if (MetadataTable.ID.equals(tableId)) {
tl = new TabletLocatorImpl(MetadataTable.ID, getLocator(context, RootTable.ID), mlo, new ZookeeperLockChecker(context));
} else {
tl = new TabletLocatorImpl(tableId, getLocator(context, MetadataTable.ID), mlo, new ZookeeperLockChecker(context));
}
locators.put(key, tl);
}
return tl;
}
Aggregations