Package org.apache.flink.api.java
Class ClosureCleaner
- java.lang.Object
-
- org.apache.flink.api.java.ClosureCleaner
-
@Internal public class ClosureCleaner extends Object
The closure cleaner is a utility that tries to truncate the closure (enclosing instance) of non-static inner classes (created for inline transformation functions). That makes non-static inner classes in many cases serializable, where Java's default behavior renders them non-serializable without good reason.
-
-
Constructor Summary
Constructors Constructor Description ClosureCleaner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclean(Object func, ExecutionConfig.ClosureCleanerLevel level, boolean checkSerializable)Tries to clean the closure of the given object, if the object is a non-static inner class.static voidensureSerializable(Object obj)
-
-
-
Method Detail
-
clean
public static void clean(Object func, ExecutionConfig.ClosureCleanerLevel level, boolean checkSerializable)
Tries to clean the closure of the given object, if the object is a non-static inner class.- Parameters:
func- The object whose closure should be cleaned.level- the clean up level.checkSerializable- Flag to indicate whether serializability should be checked after the closure cleaning attempt.- Throws:
InvalidProgramException- Thrown, if 'checkSerializable' is true, and the object was not serializable after the closure cleaning.RuntimeException- A RuntimeException may be thrown, if the code of the class could not be loaded, in order to process during the closure cleaning.
-
ensureSerializable
public static void ensureSerializable(Object obj)
-
-