org.apache.samza.zk.ZkUtils.writeTaskLocality()方法的使用及代码示例

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

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

ZkUtils.writeTaskLocality介绍

暂无

代码示例

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

for (ContainerModel containerModel : jobModel.getContainers().values()) {
 for (TaskName taskName : containerModel.getTasks().keySet()) {
  zkUtils.writeTaskLocality(taskName, locationId);

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

@Test
public void testReadAfterWriteTaskLocality() {
 zkUtils.writeTaskLocality(new TaskName("task-1"), new LocationId("LocationId-1"));
 zkUtils.writeTaskLocality(new TaskName("task-2"), new LocationId("LocationId-2"));
 Map<TaskName, LocationId> taskLocality = ImmutableMap.of(new TaskName("task-1"), new LocationId("LocationId-1"),
                              new TaskName("task-2"), new LocationId("LocationId-2"));
 Assert.assertEquals(taskLocality, zkUtils.readTaskLocality());
}

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

@Test
public void testWriteTaskLocalityShouldUpdateTheExistingValue() {
 zkUtils.writeTaskLocality(new TaskName("task-1"), new LocationId("LocationId-1"));
 Map<TaskName, LocationId> taskLocality = ImmutableMap.of(new TaskName("task-1"), new LocationId("LocationId-1"));
 Assert.assertEquals(taskLocality, zkUtils.readTaskLocality());
 zkUtils.writeTaskLocality(new TaskName("task-1"), new LocationId("LocationId-2"));
 taskLocality = ImmutableMap.of(new TaskName("task-1"), new LocationId("LocationId-2"));
 Assert.assertEquals(taskLocality, zkUtils.readTaskLocality());
}

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

@Test
public void testReadTaskLocalityShouldReturnAllTheExistingLocalityValue() {
 zkUtils.writeTaskLocality(new TaskName("task-1"), new LocationId("LocationId-1"));
 zkUtils.writeTaskLocality(new TaskName("task-2"), new LocationId("LocationId-2"));
 zkUtils.writeTaskLocality(new TaskName("task-3"), new LocationId("LocationId-3"));
 zkUtils.writeTaskLocality(new TaskName("task-4"), new LocationId("LocationId-4"));
 zkUtils.writeTaskLocality(new TaskName("task-5"), new LocationId("LocationId-5"));
 Map<TaskName, LocationId> taskLocality = ImmutableMap.of(new TaskName("task-1"), new LocationId("LocationId-1"),
                              new TaskName("task-2"), new LocationId("LocationId-2"),
                              new TaskName("task-3"), new LocationId("LocationId-3"),
                              new TaskName("task-4"), new LocationId("LocationId-4"),
                              new TaskName("task-5"), new LocationId("LocationId-5"));
 Assert.assertEquals(taskLocality, zkUtils.readTaskLocality());
}

相关文章