本文整理汇总了Java中org.apache.flink.runtime.state.StateInitializationContext.getRawKeyedStateInputs方法的典型用法代码示例。如果您正苦于以下问题:Java StateInitializationContext.getRawKeyedStateInputs方法的具体用法?Java StateInitializationContext.getRawKeyedStateInputs怎么用?Java StateInitializationContext.getRawKeyedStateInputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.runtime.state.StateInitializationContext
的用法示例。
在下文中一共展示了StateInitializationContext.getRawKeyedStateInputs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeState
import org.apache.flink.runtime.state.StateInitializationContext; //导入方法依赖的package包/类
@Override
public void initializeState(StateInitializationContext context) throws Exception {
if (getKeyedStateBackend() != null) {
KeyGroupsList localKeyGroupRange = getKeyedStateBackend().getKeyGroupRange();
for (KeyGroupStatePartitionStreamProvider streamProvider : context.getRawKeyedStateInputs()) {
DataInputViewStreamWrapper div = new DataInputViewStreamWrapper(streamProvider.getStream());
int keyGroupIdx = streamProvider.getKeyGroupId();
checkArgument(localKeyGroupRange.contains(keyGroupIdx),
"Key Group " + keyGroupIdx + " does not belong to the local range.");
// if (this instanceof KeyGroupRestoringOperator)
restoreKeyGroupState(keyGroupIdx, div);
}
}
}
示例2: initializeState
import org.apache.flink.runtime.state.StateInitializationContext; //导入方法依赖的package包/类
/**
* Stream operators with state which can be restored need to override this hook method.
*
* @param context context that allows to register different states.
*/
public void initializeState(StateInitializationContext context) throws Exception {
if (getKeyedStateBackend() != null) {
KeyGroupsList localKeyGroupRange = getKeyedStateBackend().getKeyGroupRange();
// and then initialize the timer services
for (KeyGroupStatePartitionStreamProvider streamProvider : context.getRawKeyedStateInputs()) {
int keyGroupIdx = streamProvider.getKeyGroupId();
checkArgument(localKeyGroupRange.contains(keyGroupIdx),
"Key Group " + keyGroupIdx + " does not belong to the local range.");
timeServiceManager.restoreStateForKeyGroup(
new DataInputViewStreamWrapper(streamProvider.getStream()),
keyGroupIdx, getUserCodeClassloader());
}
}
}
示例3: initializeState
import org.apache.flink.runtime.state.StateInitializationContext; //导入方法依赖的package包/类
@Override
public void initializeState(StateInitializationContext context) throws Exception {
if (getKeyedStateBackend() != null) {
int totalKeyGroups = getKeyedStateBackend().getNumberOfKeyGroups();
KeyGroupsList localKeyGroupRange = getKeyedStateBackend().getKeyGroupRange();
for (KeyGroupStatePartitionStreamProvider streamProvider : context.getRawKeyedStateInputs()) {
DataInputViewStreamWrapper div = new DataInputViewStreamWrapper(streamProvider.getStream());
int keyGroupIdx = streamProvider.getKeyGroupId();
checkArgument(localKeyGroupRange.contains(keyGroupIdx),
"Key Group " + keyGroupIdx + " does not belong to the local range.");
// if (this instanceof KeyGroupRestoringOperator)
restoreKeyGroupState(keyGroupIdx, div);
// We just initialize our timerService
if (keyCoder != null) {
if (timerService == null) {
timerService = new HeapInternalTimerService<>(
totalKeyGroups,
localKeyGroupRange,
this,
getRuntimeContext().getProcessingTimeService());
}
timerService.restoreTimersForKeyGroup(div, keyGroupIdx, getUserCodeClassloader());
}
}
}
}