synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
/** * Initializes an Accumulo {@link Instance} based on the configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return an Accumulo instance * @since 1.6.0 * @see #setZooKeeperInstance(Class, Configuration, ClientConfiguration) */ public static Instance getInstance(Class<?> implementingClass, Configuration conf) { String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE), ""); if ("MockInstance".equals(instanceType)) return DeprecationUtil .makeMockInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME))); else if ("ZooKeeperInstance".equals(instanceType)) { return new ZooKeeperInstance(getClientConfiguration(implementingClass, conf)); } else if (instanceType.isEmpty()) throw new IllegalStateException( "Instance has not been configured for " + implementingClass.getSimpleName()); else throw new IllegalStateException("Unrecognized instance type " + instanceType); }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
instance = DeprecationUtil.makeMockInstance(this.getClass().getName()); else { ClientConfiguration clientConf;
@Override public Instance getInstance() { if (mock) return DeprecationUtil.makeMockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.getClientConfiguration()); } }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(getClientConfiguration()); } }
instance = DeprecationUtil.makeMockInstance("fake"); } else { String instanceName, hosts;
public Instance getInstance(ClientConfiguration base) { if (null == instanceName) { return null; } if (isMockInstance()) { return DeprecationUtil.makeMockInstance(getInstanceName()); } if (null == zooKeepers) { return null; } return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }