Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FacesContext throws IlegalStateException on renderResponse() method call  RSS feed

nandish chitalia
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 !
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!