Hi,
I wrote a custom facelet cache (based on ehcache) to handle a very important number of xhtml without making the memory explode.
(if you are interested: the cache simply uses a SelfPopulatingCache configured with a LFU (Less Frequently Used) eviction policy)
On the development stage, I would like to deactivate this cache, so that the changes made to a xhtml is immediately re-compiled and shown.
In the constructor of my custom facelet cache, I tried to access the project stage with FacesContext.getCurrentInstance().getApplication().getProjectStage().
But I suppose that the application is still not completely configured at this point.
I got the following exception:
26.07.2010 11:43:52 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.StackOverflowError
at java.util.concurrent.locks.ReentrantLock$Sync.<init>(ReentrantLock.java:91)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.<init>(ReentrantLock.java:175)
at java.util.concurrent.locks.ReentrantLock.<init>(ReentrantLock.java:234)
at java.util.concurrent.ConcurrentHashMap$Segment.<init>(ConcurrentHashMap.java:289)
at java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:613)
at java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:652)
at com.sun.faces.util.Cache.<init>(Cache.java:69)
at com.sun.faces.application.ApplicationImpl$SystemEventHelper.<init>(ApplicationImpl.java:2164)
at com.sun.faces.application.ApplicationImpl.<init>(ApplicationImpl.java:195)
at com.sun.faces.application.ApplicationFactoryImpl.getApplication(ApplicationFactoryImpl.java:103)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:106)
Can somebody confirm that it is too "early" to get the project stage?
Should I use a system event listener (type PostConstructApplicationEvent) to achieve what I want to?
Thanks in advance
Yann
[Message sent by forum member 'yannsimon']
http://forums.java.net/jive/thread.jspa?messageID=478558