• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

removePhaseListener() does NOT work  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a PhaseListener I want to conditionally add to a Lifecycle. When the conditions are right, it successfully uses lifecycle.addPhaseListner(myConditionalListener) and it processes just fine. At the end of that cycle I want to remove that phaseListener with lifecycle.removePhaseListener(myConditionalListener) The code runs but the listener remains until I restart the application.

I have tried both

currentLifecycle.removePhaseListener(cpl);
context.getViewRoot().removePhaseListener(cpl);

With no effect.

Since this listner is costly in terms of performance and only needed in a particular set of conditions, I wanted to use removePhaseListener and I have several such conditional listeners. I would prefer if this works or if I need to do something else in addition to this or instead of this, but I can always have a customeListener that did the logic and was always in there and had its own factory but that's a kludge since removePhaseListener is there it should work, yes?
 
Do you pee on your compost? Does this tiny ad?
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!