Just implemented the filter and the clearing of the states LRUMap. As I can see all the
normal Request/Responses work fine. The Problem occurs when using Ajax based Richfaces
requests (eg ExtendedDataTable with filtering and sorting):
javax.faces.FacesException: No saved portlet window state for an id
4c4fd449-3557-426b-8cd5-f864c24692be:view:2cfaa740-1be3-46a4-bef4-28ece52dcd46
at
org.jboss.portletbridge.context.ServletExternalContextImpl.(ServletExternalContextImpl.java:101)
So now that I know why the states are cached I have a better solution solving the Memory
Leak! The PortletStateHolder needs to hold the state as long as one page is doing Ajax
based requests. So if the next page is requested PortletStateHolder does not need the old
state any more so it can clearly remove it! So when adding a new WindowState we remove the
old WindowStates for this session id:
| private void clearExpiredSessionStates(String sessionId) {
| if (states != null && sessionId != null) {
| for (StateId stateid : states.keySet()) {
| if (sessionId.equals(stateid.getScopeId())) {
| states.remove(stateid);
| }
| }
| }
| }
| public void addWindowState(StateId stateId, PortletWindowState state) {
| clearExpiredSessionStates(stateId.getScopeId());
| states.put(stateId, state);
| }
|
There's one drawback with this solution if there is more than one window open one of
the windows get an error when doing Ajax based requests as we only store one state per
session.
Working on a solution to this. Any ideas?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237238#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...