Yeah, that definitely makes sense. I was just trying to make it work somehow. The problem is that it's not at all calling the listeners, hence i'm unable to do anything. Just wanted to cross check it by looping inside. But I get the point. thank you for that!
I'm on YARN(cluster mode). [image: --] Tariq, Mohammad [image: https://]about.me/mti <https://about.me/mti?promo=email_sig&utm_source=email_sig&utm_medium=external_link&utm_campaign=chrome_ext> [image: http://] Tariq, Mohammad about.me/mti [image: http://] <http://about.me/mti> On Fri, Nov 11, 2016 at 4:19 AM, Marcelo Vanzin <van...@cloudera.com> wrote: > On Thu, Nov 10, 2016 at 2:43 PM, Mohammad Tariq <donta...@gmail.com> > wrote: > > @Override > > public void stateChanged(SparkAppHandle handle) { > > System.out.println("Spark App Id [" + handle.getAppId() + "]. State > [" + handle.getState() + "]"); > > while(!handle.getState().isFinal()) { > > You shouldn't loop in an event handler. That's not really how > listeners work. Instead, use the event handler to update some local > state, or signal some thread that's waiting for the state change. > > Also be aware that handles currently only work in local and yarn > modes; the state updates haven't been hooked up to standalone mode > (maybe for client mode, but definitely not cluster) nor mesos. > > -- > Marcelo >