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

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

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

ZkBarrierListener.onBarrierStateChanged介绍

[英]Invoked when the data written to the Barrier state changes
[中]写入屏障状态的数据更改时调用

代码示例

代码示例来源:origin: org.apache.samza/samza-core_2.11

@Override
public void doHandleDataChange(String dataPath, Object data) {
 LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data));
 State barrierState = (State) data;
 List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT);
 if (barrierState != null && expectedBarrierStates.contains(barrierState)) {
  zkUtils.unsubscribeDataChanges(barrierStatePath, this);
  barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data));
 } else {
  LOG.debug("Barrier version: {} is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState);
 }
}

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

@Override
public void doHandleDataChange(String dataPath, Object data) {
 LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data));
 State barrierState = (State) data;
 List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT);
 if (barrierState != null && expectedBarrierStates.contains(barrierState)) {
  zkUtils.unsubscribeDataChanges(barrierStatePath, this);
  barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data));
 } else {
  LOG.debug("Barrier version: {} is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

@Override
public void doHandleDataChange(String dataPath, Object data) {
 LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data));
 State barrierState = (State) data;
 List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT);
 if (barrierState != null && expectedBarrierStates.contains(barrierState)) {
  zkUtils.unsubscribeDataChanges(barrierStatePath, this);
  barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data));
 } else {
  LOG.debug("Barrier version: {} is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState);
 }
}

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

@Override
public void doHandleDataChange(String dataPath, Object data) {
 LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data));
 State barrierState = (State) data;
 List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT);
 if (barrierState != null && expectedBarrierStates.contains(barrierState)) {
  zkUtils.unsubscribeDataChanges(barrierStatePath, this);
  barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data));
 } else {
  LOG.debug("Barrier version: {} is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

@Override
public void doHandleDataChange(String dataPath, Object data) {
 LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data));
 State barrierState = (State) data;
 List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT);
 if (barrierState != null && expectedBarrierStates.contains(barrierState)) {
  zkUtils.unsubscribeDataChanges(barrierStatePath, this);
  barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data));
 } else {
  LOG.debug("Barrier version: {} is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState);
 }
}

相关文章