public CassandraCommitter(ClusterBuilder builder) { this.builder = builder; ClosureCleaner.clean(builder, true); }
protected CassandraTupleWriteAheadSink(String insertQuery, TypeSerializer<IN> serializer, ClusterBuilder builder, CheckpointCommitter committer) throws Exception { super(committer, serializer, UUID.randomUUID().toString().replace("-", "_")); this.insertQuery = insertQuery; this.builder = builder; ClosureCleaner.clean(builder, true); }
protected CassandraRowWriteAheadSink(String insertQuery, TypeSerializer<Row> serializer, ClusterBuilder builder, CheckpointCommitter committer) throws Exception { super(committer, serializer, UUID.randomUUID().toString().replace("-", "_")); this.insertQuery = insertQuery; this.builder = builder; ClosureCleaner.clean(builder, true); }
CassandraSinkBase(ClusterBuilder builder, CassandraSinkBaseConfig config, CassandraFailureHandler failureHandler) { this.builder = builder; this.config = config; this.failureHandler = Preconditions.checkNotNull(failureHandler); ClosureCleaner.clean(builder, true); }
requireNonNull(serializationSchema, "serializationSchema not set"); requireNonNull(producerConfig, "producerConfig not set"); ClosureCleaner.clean(customPartitioner, true); ClosureCleaner.ensureSerializable(serializationSchema);
/** * Adds a condition that has to be satisfied by an event * in order to be considered a match. If another condition has already been * set, the new one is going to be combined with the previous with a * logical {@code OR}. In other case, this is going to be the only * condition. * * @param condition The condition as an {@link IterativeCondition}. * @return The pattern with the new condition is set. */ public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichOrCondition<>(this.condition, condition); } return this; }
ClosureCleaner.clean(assigner, true); this.punctuatedWatermarkAssigner = new SerializedValue<>(assigner); return this;
ClosureCleaner.clean(assigner, true); this.periodicWatermarkAssigner = new SerializedValue<>(assigner); return this;
/** * Adds a condition that has to be satisfied by an event * in order to be considered a match. If another condition has already been * set, the new one is going to be combined with the previous with a * logical {@code AND}. In other case, this is going to be the only * condition. * * @param condition The condition as an {@link IterativeCondition}. * @return The pattern with the new condition is set. */ public Pattern<T, F> where(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichAndCondition<>(this.condition, condition); } return this; }
/** * Returns a "closure-cleaned" version of the given function. Cleans only if closure cleaning * is not disabled in the {@link org.apache.flink.api.common.ExecutionConfig} */ @Internal public <F> F clean(F f) { if (getConfig().isClosureCleanerEnabled()) { ClosureCleaner.clean(f, true); } ClosureCleaner.ensureSerializable(f); return f; }
public <F> F clean(F f) { if (getExecutionEnvironment().getConfig().isClosureCleanerEnabled()) { ClosureCleaner.clean(f, true); } else { ClosureCleaner.ensureSerializable(f); } return f; }
/** * Applies a stop condition for a looping state. It allows cleaning the underlying state. * * @param untilCondition a condition an event has to satisfy to stop collecting events into looping state * @return The same pattern with applied untilCondition */ public Pattern<T, F> until(IterativeCondition<F> untilCondition) { Preconditions.checkNotNull(untilCondition, "The condition cannot be null"); if (this.untilCondition != null) { throw new MalformedPatternException("Only one until condition can be applied."); } if (!quantifier.hasProperty(Quantifier.QuantifierProperty.LOOPING)) { throw new MalformedPatternException("The until condition is only applicable to looping states."); } ClosureCleaner.clean(untilCondition, true); this.untilCondition = untilCondition; return this; }
public KeyedTwoInputStreamOperatorTestHarness( TwoInputStreamOperator<IN1, IN2, OUT> operator, KeySelector<IN1, K> keySelector1, KeySelector<IN2, K> keySelector2, TypeInformation<K> keyType, int maxParallelism, int numSubtasks, int subtaskIndex) throws Exception { super(operator, maxParallelism, numSubtasks, subtaskIndex); ClosureCleaner.clean(keySelector1, false); ClosureCleaner.clean(keySelector2, false); config.setStatePartitioner(0, keySelector1); config.setStatePartitioner(1, keySelector2); config.setStateKeySerializer(keyType.createSerializer(executionConfig)); }
public KeyedOneInputStreamOperatorTestHarness( OneInputStreamOperator<IN, OUT> operator, final KeySelector<IN, K> keySelector, TypeInformation<K> keyType, int maxParallelism, int numSubtasks, int subtaskIndex) throws Exception { super(operator, maxParallelism, numSubtasks, subtaskIndex); ClosureCleaner.clean(keySelector, false); config.setStatePartitioner(0, keySelector); config.setStateKeySerializer(keyType.createSerializer(executionConfig)); }
public <K> void configureForKeyedStream( KeySelector<IN, K> keySelector, TypeInformation<K> keyType) { ClosureCleaner.clean(keySelector, false); streamConfig.setStatePartitioner(0, keySelector); streamConfig.setStateKeySerializer(keyType.createSerializer(executionConfig)); }
public KeyedOneInputStreamOperatorTestHarness( final OneInputStreamOperator<IN, OUT> operator, final KeySelector<IN, K> keySelector, final TypeInformation<K> keyType, final MockEnvironment environment) throws Exception { super(operator, environment); ClosureCleaner.clean(keySelector, false); config.setStatePartitioner(0, keySelector); config.setStateKeySerializer(keyType.createSerializer(executionConfig)); }
@Test public void testSerializable() throws Exception { MapCreator creator = new SerializableMapCreator(1); MapFunction<Integer, Integer> map = creator.getMap(); ClosureCleaner.clean(map, true); int result = map.map(3); Assert.assertEquals(result, 4); }
@Test public void testCleanedNonSerializable() throws Exception { MapCreator creator = new NonSerializableMapCreator(); MapFunction<Integer, Integer> map = creator.getMap(); ClosureCleaner.clean(map, true); int result = map.map(3); Assert.assertEquals(result, 4); }
@Test public void testNestedSerializable() throws Exception { MapCreator creator = new NestedSerializableMapCreator(1); MapFunction<Integer, Integer> map = creator.getMap(); ClosureCleaner.clean(map, true); ClosureCleaner.ensureSerializable(map); int result = map.map(3); Assert.assertEquals(result, 4); }
@Test(expected = InvalidProgramException.class) public void testNestedNonSerializable() throws Exception { MapCreator creator = new NestedNonSerializableMapCreator(1); MapFunction<Integer, Integer> map = creator.getMap(); ClosureCleaner.clean(map, true); ClosureCleaner.ensureSerializable(map); int result = map.map(3); Assert.assertEquals(result, 4); } }