Exemple #1
0
 private static ZooCache getZooCache(Instance instance) {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     sm.checkPermission(TABLES_PERMISSION);
   }
   return ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
 }
 /**
  * @param config Client configuration for specifying connection options. See {@link
  *     ClientConfiguration} which extends Configuration with convenience methods specific to
  *     Accumulo.
  * @since 1.6.0
  */
 public ZooKeeperInstance(Configuration config) {
   ArgumentChecker.notNull(config);
   if (config instanceof ClientConfiguration) {
     this.clientConf = (ClientConfiguration) config;
   } else {
     this.clientConf = new ClientConfiguration(config);
   }
   this.instanceId = clientConf.get(ClientProperty.INSTANCE_ID);
   this.instanceName = clientConf.get(ClientProperty.INSTANCE_NAME);
   if ((instanceId == null) == (instanceName == null))
     throw new IllegalArgumentException(
         "Expected exactly one of instanceName and instanceId to be set");
   this.zooKeepers = clientConf.get(ClientProperty.INSTANCE_ZK_HOST);
   this.zooKeepersSessionTimeOut =
       (int)
           AccumuloConfiguration.getTimeInMillis(
               clientConf.get(ClientProperty.INSTANCE_ZK_TIMEOUT));
   zooCache = ZooCache.getInstance(zooKeepers, zooKeepersSessionTimeOut);
 }