How graceful shutdown or resource clean up happens in Flink at task level ?

Posted by sohimankotia on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/How-graceful-shutdown-or-resource-clean-up-happens-in-Flink-at-task-level-tp16825.html

Let's assume I have following class :

public class TestFlatMap extends RichFlatMapFunction<String,String> {

        private Connection connection ;

        @Override
        public void open(Configuration parameters) throws Exception {
                super.open(parameters);
                // Open Connection
        }

        @Override
        public void flatMap(String value, Collector<String> out) throws Exception {

                // Error while executing record


        }


        @Override
        public void close() throws Exception {
                super.close();
                // Close Connection
        }
}


In which cases close () will be called by flink to clean up resources  , if
there is erro in flatMap function ?

1. Some programmatic error (NullPointer Exception)
2. OutOfMemoryError
3. Syste.exit(0)


I just wanted to

1. how flink will handle cleanup of resources (code written in close method
).?
2. How does it handle graceful shutdown at task level  ?



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/