Search in sources :

Example 1 with MetadataLocationObtainer

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;
}
Also used : MetadataLocationObtainer(org.apache.accumulo.core.metadata.MetadataLocationObtainer) Instance(org.apache.accumulo.core.client.Instance)

Example 2 with MetadataLocationObtainer

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;
}
Also used : MetadataLocationObtainer(org.apache.accumulo.core.metadata.MetadataLocationObtainer)

Aggregations

MetadataLocationObtainer (org.apache.accumulo.core.metadata.MetadataLocationObtainer)2 Instance (org.apache.accumulo.core.client.Instance)1