Java Code Examples for org.apache.flink.runtime.state.StateInitializationContext#getRawKeyedStateInputs()
The following examples show how to use
org.apache.flink.runtime.state.StateInitializationContext#getRawKeyedStateInputs() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamTaskTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void initializeState(StateInitializationContext context) throws Exception { keyedStateBackend = (AbstractKeyedStateBackend<?>) getKeyedStateBackend(); operatorStateBackend = getOperatorStateBackend(); rawOperatorStateInputs = (CloseableIterable<StatePartitionStreamProvider>) context.getRawOperatorStateInputs(); rawKeyedStateInputs = (CloseableIterable<KeyGroupStatePartitionStreamProvider>) context.getRawKeyedStateInputs(); super.initializeState(context); }
Example 2
Source File: StreamTaskTest.java From flink with Apache License 2.0 | 5 votes |
@Override public void initializeState(StateInitializationContext context) throws Exception { keyedStateBackend = (AbstractKeyedStateBackend<?>) getKeyedStateBackend(); operatorStateBackend = getOperatorStateBackend(); rawOperatorStateInputs = (CloseableIterable<StatePartitionStreamProvider>) context.getRawOperatorStateInputs(); rawKeyedStateInputs = (CloseableIterable<KeyGroupStatePartitionStreamProvider>) context.getRawKeyedStateInputs(); super.initializeState(context); }
Example 3
Source File: FeedbackUnionOperator.java From stateful-functions with Apache License 2.0 | 5 votes |
@Override public void initializeState(StateInitializationContext context) throws Exception { super.initializeState(context); final IOManager ioManager = getContainingTask().getEnvironment().getIOManager(); final int maxParallelism = getRuntimeContext().getMaxNumberOfParallelSubtasks(); this.reusable = new StreamRecord<>(null); // // Initialize the unbounded feedback logger // @SuppressWarnings("unchecked") UnboundedFeedbackLogger<T> feedbackLogger = (UnboundedFeedbackLogger<T>) Loggers.unboundedSpillableLogger( ioManager, maxParallelism, totalMemoryUsedForFeedbackCheckpointing, elementSerializer, keySelector); this.feedbackLogger = feedbackLogger; // // we first must reply previously check-pointed envelopes before we start // processing any new envelopes. // for (KeyGroupStatePartitionStreamProvider keyedStateInput : context.getRawKeyedStateInputs()) { this.feedbackLogger.replyLoggedEnvelops(keyedStateInput.getStream(), this); } // // now we can start processing new messages. We do so by registering ourselves as a // FeedbackConsumer // registerFeedbackConsumer(new MailboxExecutorFacade(mailboxExecutor, "Feedback Consumer")); }
Example 4
Source File: FeedbackUnionOperator.java From flink-statefun with Apache License 2.0 | 5 votes |
@Override public void initializeState(StateInitializationContext context) throws Exception { super.initializeState(context); final IOManager ioManager = getContainingTask().getEnvironment().getIOManager(); final int maxParallelism = getRuntimeContext().getMaxNumberOfParallelSubtasks(); this.reusable = new StreamRecord<>(null); // // Initialize the unbounded feedback logger // @SuppressWarnings("unchecked") UnboundedFeedbackLoggerFactory<T> feedbackLoggerFactory = (UnboundedFeedbackLoggerFactory<T>) Loggers.unboundedSpillableLoggerFactory( ioManager, maxParallelism, totalMemoryUsedForFeedbackCheckpointing, elementSerializer, keySelector); this.checkpoints = new Checkpoints<>(feedbackLoggerFactory::create); // // we first must reply previously check-pointed envelopes before we start // processing any new envelopes. // UnboundedFeedbackLogger<T> logger = feedbackLoggerFactory.create(); for (KeyGroupStatePartitionStreamProvider keyedStateInput : context.getRawKeyedStateInputs()) { logger.replyLoggedEnvelops(keyedStateInput.getStream(), this); } // // now we can start processing new messages. We do so by registering ourselves as a // FeedbackConsumer // registerFeedbackConsumer(new MailboxExecutorFacade(mailboxExecutor, "Feedback Consumer")); }
Example 5
Source File: StreamTaskTest.java From flink with Apache License 2.0 | 5 votes |
@Override public void initializeState(StateInitializationContext controller) throws Exception { keyedStateBackend = (AbstractKeyedStateBackend<?>) getKeyedStateBackend(); operatorStateBackend = getOperatorStateBackend(); rawOperatorStateInputs = (CloseableIterable<StatePartitionStreamProvider>) controller.getRawOperatorStateInputs(); rawKeyedStateInputs = (CloseableIterable<KeyGroupStatePartitionStreamProvider>) controller.getRawKeyedStateInputs(); super.initializeState(controller); }