本文整理了Java中org.apache.helix.manager.zk.ZkClient.setZkSerializer()
方法的一些代码示例,展示了ZkClient.setZkSerializer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClient.setZkSerializer()
方法的具体详情如下:
包路径:org.apache.helix.manager.zk.ZkClient
类名称:ZkClient
方法名:setZkSerializer
暂无
代码示例来源:origin: apache/incubator-pinot
public void start(ControllerMetrics controllerMetrics) {
_controllerMetrics = controllerMetrics;
LOGGER.info("Starting realtime segments manager, adding a listener on the property store table configs path.");
String zkUrl = _pinotHelixResourceManager.getHelixZkURL();
_zkClient = new ZkClient(zkUrl, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT);
_zkClient.setZkSerializer(new ZNRecordSerializer());
_zkClient.waitUntilConnected(CommonConstants.Helix.ZkClient.DEFAULT_CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
// Subscribe to any data/child changes to property
_zkClient.subscribeChildChanges(_tableConfigPath, this);
_zkClient.subscribeDataChanges(_tableConfigPath, this);
// Subscribe to leadership changes
ControllerLeadershipManager.getInstance().subscribe(PinotLLCRealtimeSegmentManager.class.getName(), this);
// Setup change listeners for already existing tables, if any.
processPropertyStoreChange(_tableConfigPath);
}
代码示例来源:origin: apache/incubator-pinot
ZkClient zkClient = new ZkClient(zkPath);
zkClient.waitUntilConnected(CommonConstants.Helix.ZkClient.DEFAULT_CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
zkClient.setZkSerializer(new ZNRecordSerializer());
HelixDataAccessor accessor =
new ZKHelixDataAccessor(helixClusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
代码示例来源:origin: apache/incubator-pinot
zkClient.setZkSerializer(new ZNRecordStreamingSerializer());
LOGGER.info("Connecting to Zookeeper at: {}", _zkAddress);
zkClient.waitUntilConnected(CommonConstants.Helix.ZkClient.DEFAULT_CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
代码示例来源:origin: org.apache.helix/helix-core
public ZKDumper(String zkAddress) {
client = new ZkClient(zkAddress, ZkClient.DEFAULT_CONNECTION_TIMEOUT);
ZkSerializer zkSerializer = new ByteArraySerializer();
client.setZkSerializer(zkSerializer);
filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return !name.startsWith(".");
}
};
}
代码示例来源:origin: org.apache.helix/helix-core
public ZKHelixAdmin(String zkAddress) {
int timeOutInSec = Integer.parseInt(System.getProperty(CONNECTION_TIMEOUT, "30"));
_zkClient = new ZkClient(zkAddress, timeOutInSec * 1000);
_zkClient.setZkSerializer(new ZNRecordSerializer());
_zkClient.waitUntilConnected(timeOutInSec, TimeUnit.SECONDS);
_configAccessor = new ConfigAccessor(_zkClient);
}
代码示例来源:origin: org.apache.helix/helix-core
private static Map<TestCommand, Boolean> executeTestHelper(List<TestCommand> commandList,
String zkAddr, CountDownLatch countDown) {
final Map<TestCommand, Boolean> testResults = new ConcurrentHashMap<TestCommand, Boolean>();
ZkClient zkClient = null;
zkClient = new ZkClient(zkAddr, ZkClient.DEFAULT_CONNECTION_TIMEOUT);
zkClient.setZkSerializer(new ZNRecordSerializer());
// sort on trigger's start time, stable sort
Collections.sort(commandList, new Comparator<TestCommand>() {
@Override
public int compare(TestCommand o1, TestCommand o2) {
return (int) (o1._trigger._startTime - o2._trigger._startTime);
}
});
for (TestCommand command : commandList) {
testResults.put(command, new Boolean(false));
TestTrigger trigger = command._trigger;
command._startTimestamp = System.currentTimeMillis() + trigger._startTime;
new Thread(new ExecuteCommand(command._startTimestamp, command, countDown, zkClient,
testResults)).start();
}
return testResults;
}
代码示例来源:origin: org.apache.helix/helix-core
public static void main(String[] args) {
ZkClient zkclient = new ZkClient("localhost:2191");
zkclient.setZkSerializer(new ZNRecordSerializer());
ZkBaseDataAccessor<ZNRecord> accessor = new ZkBaseDataAccessor<ZNRecord>(zkclient);
代码示例来源:origin: apache/helix
@BeforeClass
public void beforeClass() {
_zkClient = new ZkClient(ZK_ADDR);
_zkClient.setZkSerializer(new ZNRecordSerializer());
}
代码示例来源:origin: apache/helix
public static String getInstancePropertiesAsString(ZkClient zkClient, String clusterName,
PropertyKey propertyKey, MediaType mediaType) throws JsonGenerationException,
JsonMappingException, IOException {
zkClient.setZkSerializer(new ZNRecordSerializer());
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
List<ZNRecord> records = HelixProperty.convertToList(accessor.getChildValues(propertyKey));
return ObjectToJson(records);
}
代码示例来源:origin: org.apache.helix/helix-core
public void post(String zkServer, Message message, String clusterName, String instanceName) {
ZkClient client = new ZkClient(zkServer);
client.setZkSerializer(new ZNRecordSerializer());
String path = PropertyPathBuilder.instanceMessage(clusterName, instanceName, message.getId());
client.delete(path);
ZNRecord record = client.readData(PropertyPathBuilder.liveInstance(clusterName, instanceName));
message.setTgtSessionId(record.getSimpleField(LiveInstanceProperty.SESSION_ID.toString()));
message.setTgtName(record.getId());
// System.out.println(message);
client.createPersistent(path, message.getRecord());
}
内容来源于网络,如有侵权,请联系作者删除!