/** * @see KeyedStateBackend */ @Override public <N, S extends State, T> void applyToAllKeys( final N namespace, final TypeSerializer<N> namespaceSerializer, final StateDescriptor<S, T> stateDescriptor, final KeyedStateFunction<K, S> function) throws Exception { try (Stream<K> keyStream = getKeys(stateDescriptor.getName(), namespace)) { final S state = getPartitionedState( namespace, namespaceSerializer, stateDescriptor); keyStream.forEach((K key) -> { setCurrentKey(key); try { function.process(key, state); } catch (Throwable e) { // we wrap the checked exception in an unchecked // one and catch it (and re-throw it) later. throw new RuntimeException(e); } }); } }
/** * @see KeyedStateBackend */ @Override public <N, S extends State, T> void applyToAllKeys( final N namespace, final TypeSerializer<N> namespaceSerializer, final StateDescriptor<S, T> stateDescriptor, final KeyedStateFunction<K, S> function) throws Exception { try (Stream<K> keyStream = getKeys(stateDescriptor.getName(), namespace)) { final S state = getPartitionedState( namespace, namespaceSerializer, stateDescriptor); keyStream.forEach((K key) -> { setCurrentKey(key); try { function.process(key, state); } catch (Throwable e) { // we wrap the checked exception in an unchecked // one and catch it (and re-throw it) later. throw new RuntimeException(e); } }); } }
/** * @see KeyedStateBackend */ @Override public <N, S extends State, T> void applyToAllKeys( final N namespace, final TypeSerializer<N> namespaceSerializer, final StateDescriptor<S, T> stateDescriptor, final KeyedStateFunction<K, S> function) throws Exception { try (Stream<K> keyStream = getKeys(stateDescriptor.getName(), namespace)) { final S state = getPartitionedState( namespace, namespaceSerializer, stateDescriptor); keyStream.forEach((K key) -> { setCurrentKey(key); try { function.process(key, state); } catch (Throwable e) { // we wrap the checked exception in an unchecked // one and catch it (and re-throw it) later. throw new RuntimeException(e); } }); } catch (RuntimeException e) { throw e; } }