This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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?
 
I think I'll just lie down here for a second. And ponder this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!