• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FacesContext throws IlegalStateException on renderResponse() method call

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I require to implement a functionality of a timer when a page loads up.
I created a PhaseListener where a thread is created in the afterPhase() method when the Phase is RenderResponse.

I created another thread in the same method which waits for the first thread to complete.

Both the threads are synchronised on the FacesContext instance.

However, when the second thread gets the control and calls the facesContext object's renderResponse(), I get an IllegalStateException.

I decompiled the FacesContextImpl class where there is a boolean variable called 'released' which is set to true in release() method. And the renderResponse throws an IllegalStateException if this variable evaluates to true.

I tried FacesContext.getCurrentInstance().renderResponse() as well, but it gives me a NullPointerException.

Please help me out on this. I am new to JSF and I understand there might be fundamental flaws in my design as well. If there is any other way to implement this functionality, please do let me know.

Thanks in advance. Cheers !
reply
    Bookmark Topic Watch Topic
  • New Topic