config.enableClosureCleaner(); } else { config.disableClosureCleaner();
@Test public void testDefaultJoinOnTwoCustomTypeInputsWithInnerClassKeyExtractorsDisabledClosureCleaner() throws Exception { /* * (Default) Join on two custom type inputs with key extractors, check if disabling closure cleaning works */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableClosureCleaner(); DataSet<CustomType> ds1 = CollectionDataSets.getCustomTypeDataSet(env); DataSet<CustomType> ds2 = CollectionDataSets.getSmallCustomTypeDataSet(env); boolean correctExceptionTriggered = false; try { DataSet<Tuple2<CustomType, CustomType>> joinDs = ds1.join(ds2) .where(new KeySelector<CustomType, Integer>() { @Override public Integer getKey(CustomType value) { return value.myInt; } }) .equalTo(new KeySelector<CustomType, Integer>() { @Override public Integer getKey(CustomType value) throws Exception { return value.myInt; } }); } catch (InvalidProgramException ex) { correctExceptionTriggered = (ex.getCause() instanceof java.io.NotSerializableException); } Assert.assertTrue(correctExceptionTriggered); }
env.getConfig().disableClosureCleaner();