org.apache.helix.manager.zk.ZKHelixDataAccessor.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.apache.helix.manager.zk.ZKHelixDataAccessor.<init>()方法的一些代码示例,展示了ZKHelixDataAccessor.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKHelixDataAccessor.<init>()方法的具体详情如下:
包路径:org.apache.helix.manager.zk.ZKHelixDataAccessor
类名称:ZKHelixDataAccessor
方法名:<init>

ZKHelixDataAccessor.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

zkClient.setZkSerializer(new ZNRecordSerializer());
HelixDataAccessor accessor =
  new ZKHelixDataAccessor(helixClusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
PropertyKey.Builder keyBuilder = accessor.keyBuilder();
accessor.setProperty(keyBuilder.stateModelDef(segmentStateModelName), newStateModelDef);

代码示例来源:origin: apache/incubator-pinot

zkClient.waitUntilConnected(CommonConstants.Helix.ZkClient.DEFAULT_CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
ZkBaseDataAccessor<ZNRecord> baseDataAccessor = new ZkBaseDataAccessor<>(zkClient);
ZKHelixDataAccessor zkHelixDataAccessor = new ZKHelixDataAccessor(_clusterName, baseDataAccessor);
PropertyKey property = zkHelixDataAccessor.keyBuilder().liveInstances();
List<String> liveInstances = zkHelixDataAccessor.getChildNames(property);

代码示例来源:origin: apache/helix

@Override
public boolean verify() {
 try {
  HelixDataAccessor accessor =
    new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
  return verifyBestPossAndExtView(accessor, errStates, clusterName, resources);
 } catch (Exception e) {
  LOG.error("exception in verification", e);
 }
 return false;
}

代码示例来源:origin: org.apache.helix/helix-core

@Override
public boolean verify() {
 try {
  HelixDataAccessor accessor =
    new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
  return verifyBestPossAndExtView(accessor, errStates, clusterName, resources);
 } catch (Exception e) {
  LOG.error("exception in verification", e);
 }
 return false;
}

代码示例来源:origin: org.apache.helix/helix-core

public ZkHelixClusterVerifier(ZkClient zkClient, String clusterName) {
 if (zkClient == null || clusterName == null) {
  throw new IllegalArgumentException("requires zkClient|clusterName");
 }
 _zkClient = zkClient;
 _clusterName = clusterName;
 _accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 _keyBuilder = _accessor.keyBuilder();
}

代码示例来源:origin: org.apache.helix/helix-core

public ZkHelixClusterVerifier(String zkAddr, String clusterName) {
 if (zkAddr == null || clusterName == null) {
  throw new IllegalArgumentException("requires zkAddr|clusterName");
 }
 _zkClient = ZKClientPool.getZkClient(zkAddr);
 _clusterName = clusterName;
 _accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 _keyBuilder = _accessor.keyBuilder();
}

代码示例来源:origin: apache/helix

public ClusterVerifier(HelixZkClient zkclient, String clusterName) {
 _zkclient = zkclient;
 _clusterName = clusterName;
 _accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkclient));
 _keyBuilder = _accessor.keyBuilder();
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster

public GobblinHelixTaskDriver(ZkClient client, ZkBaseDataAccessor<ZNRecord> baseAccessor, String clusterName) {
 this(new ZKHelixAdmin(client), new ZKHelixDataAccessor(clusterName, baseAccessor),
   new ConfigAccessor(client), new ZkHelixPropertyStore<ZNRecord>(baseAccessor,
     PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, clusterName), null), clusterName);
}

代码示例来源:origin: apache/helix

@Override
public IdealState getResourceIdealState(String clusterName, String resourceName) {
 HelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 return accessor.getProperty(keyBuilder.idealStates(resourceName));
}

代码示例来源:origin: org.apache.helix/helix-core

@Override
public IdealState getResourceIdealState(String clusterName, String resourceName) {
 HelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 return accessor.getProperty(keyBuilder.idealStates(resourceName));
}

代码示例来源:origin: org.apache.helix/helix-core

@Override
public void dropResource(String clusterName, String resourceName) {
 logger.info("Drop resource {} from cluster {}", resourceName, clusterName);
 HelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 accessor.removeProperty(keyBuilder.idealStates(resourceName));
 accessor.removeProperty(keyBuilder.resourceConfig(resourceName));
}

代码示例来源:origin: apache/helix

@Override
public void dropResource(String clusterName, String resourceName) {
 logger.info("Drop resource {} from cluster {}", resourceName, clusterName);
 HelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 accessor.removeProperty(keyBuilder.idealStates(resourceName));
 accessor.removeProperty(keyBuilder.resourceConfig(resourceName));
}

代码示例来源:origin: apache/helix

@Override
public StateModelDefinition getStateModelDef(String clusterName, String stateModelName) {
 HelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 return accessor.getProperty(keyBuilder.stateModelDef(stateModelName));
}

代码示例来源:origin: apache/helix

public ZkHelixClusterVerifier(String zkAddr, String clusterName) {
 if (zkAddr == null || clusterName == null) {
  throw new IllegalArgumentException("requires zkAddr|clusterName");
 }
 _zkClient = DedicatedZkClientFactory.getInstance()
   .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddr));
 _zkClient.setZkSerializer(new ZNRecordSerializer());
 _clusterName = clusterName;
 _accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 _keyBuilder = _accessor.keyBuilder();
}

代码示例来源:origin: apache/helix

public static String getClusterPropertyAsString(ZkClient zkClient, String clusterName,
  MediaType mediaType, PropertyKey propertyKey) throws JsonGenerationException,
  JsonMappingException, IOException {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 HelixProperty property = accessor.getProperty(propertyKey);
 ZNRecord record = property == null ? null : property.getRecord();
 return ZNRecordToJson(record);
}

代码示例来源:origin: apache/helix

public static String getInstanceSessionId(ZkClient zkClient, String clusterName,
  String instanceName) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 ZNRecord liveInstance = accessor.getProperty(keyBuilder.liveInstance(instanceName)).getRecord();
 return liveInstance.getSimpleField(LiveInstanceProperty.SESSION_ID.toString());
}

代码示例来源:origin: apache/helix

private void cleanupRebalanceError() {
 ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(CLUSTER_NAME, _baseAccessor);
 PropertyKey errorNodeKey =
   accessor.keyBuilder().controllerTaskError(RebalanceResourceFailure.name());
 accessor.removeProperty(errorNodeKey);
}

代码示例来源:origin: apache/helix

protected String getCurrentLeader(HelixZkClient zkClient, String clusterName) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
 if (leader == null) {
  return null;
 }
 return leader.getInstanceName();
}

代码示例来源:origin: apache/helix

protected void setupLiveInstances(String clusterName, int[] liveInstances) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
 Builder keyBuilder = accessor.keyBuilder();
 for (int i = 0; i < liveInstances.length; i++) {
  String instance = "localhost_" + liveInstances[i];
  LiveInstance liveInstance = new LiveInstance(instance);
  liveInstance.setSessionId("session_" + liveInstances[i]);
  liveInstance.setHelixVersion("0.0.0");
  accessor.setProperty(keyBuilder.liveInstance(instance), liveInstance);
 }
}

代码示例来源:origin: apache/helix

private void clearStatusUpdate(String clusterName, String instance, String resource,
  String partition) {
 // clear status update for error partition so verify() will not fail on old
 // errors
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
 Builder keyBuilder = accessor.keyBuilder();
 LiveInstance liveInstance = accessor.getProperty(keyBuilder.liveInstance(instance));
 accessor.removeProperty(keyBuilder.stateTransitionStatus(instance, liveInstance.getSessionId(),
   resource, partition));
}
// TODO: throw exception in reset()

相关文章