You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2009/12/03 23:21:29 UTC
svn commit: r886954 - in /myfaces/trinidad/branches/trinidad-2.0.x:
src/site/xdoc/devguide/ trinidad-examples/trinidad-demo/
trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/
trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/applic...
Author: gcrawford
Date: Thu Dec 3 22:21:28 2009
New Revision: 886954
URL: http://svn.apache.org/viewvc?rev=886954&view=rev
Log:
TRINIDAD-1653 trinidad 2: remove application view cache
Modified:
myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/ (props changed)
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
Modified: myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml?rev=886954&r1=886953&r2=886954&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/src/site/xdoc/devguide/configuration.xml Thu Dec 3 22:21:28 2009
@@ -413,16 +413,6 @@
</ul>
</p>
</subsection>
-<subsection name="org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE">
-<p>
-This configuration option enables an optimized strategy for caching some
-view state at an application level, which significantly improves
-scalability. However, it makes it harder to develop (updates to
-pages will not be noticed until the server is restarted), and in
-some rare cases cannot be used for some pages. See below for
-more information about this option. The default is false.
-</p>
-</subsection>
<subsection name="org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT">
<p>
Apache Trinidad by default obfuscates the Javascript it delivers
@@ -497,140 +487,6 @@
memory, so memory-limited servers may in some cases benefit from using
"all" client-side state saving.</p>
-<subsection name="The Application View Cache">
-<p>
- <font color="#FF0000">
- <strong>
-This feature is NOT supported.
- </strong>
-See <a href="https://issues.apache.org/jira/browse/TRINIDAD-1487" style="color:red">TRINIDAD-1487</a> for more.
- </font>
-</p>
-<p>
-Apache Trinidad supports a special Application View Cache feature
-that can increase scalability significantly. However, it
-can, in some unusual cases, break an otherwise functioning
-application, so it is important to understand how it works
-to understand whether it can be enabled for your pages.
-</p>
-<p>
-In conventional JSF state saving, a page's UI state is saved
-the same way every time it is used. It doesn't matter if
-state is being saved for an initial render of a page, or if
-state is being saved after a user has posted back to that page.
-No two postbacks are necessarily the same - the user may
-have entered entirely different data, navigated to
-a different set of rows in the table, etc. So, it is extremely
-difficult to share state among postback requests.</p>
-
-<p>However, most of the time, all initial renders of any
-one page have exactly the same view state. It doesn't matter
-if the page is showing different data, or responding to
-different query parameters, and so forth, because in JSF
-those are conventionally accessed using the JSF expression
-language (EL). In JSF, what state saving remembers isn't the
-result of evaluating an EL expression - it's the EL expression
-itself. So, when you see:
-<source><![CDATA[
- <tr:outputText value="#{mybean.value}"/>
-]]>
-</source>
-... all that's being saved is "#{mybean.value}", and that state is
-the same no matter what that expression evaluates to.
-</p>
-<p>
-The Application View Cache takes advantage of this, and caches
-the state for these initial renders at an application scope.
-Once the page has been viewed once, all users can reuse that
-same state coming and going, saving some CPU (the CPU cost
-of saving the state each time) and more importantly the
-memory overhead of keeping separate copies for each user.
-State saving for postback is still separated per user,
-but keep in mind that if the result of a postback is
-that you navigate to a new page, the Application View
-Cache is still in effect - it is only disabled when a postback
-remains on a page (for example, because of a validation
-failure).
-</p>
-<p>
-Perhaps even more importantly, the Application View Cache enables
-the use of web Proxy Caches in front of
-your application server. Token-based client-side state saving
-defeats web proxy caches, because each user may have a different
-token for any one page, defeating cacheability. The Application
-View Cache uses the same token across all users.
-</p>
-<p>All this should raise the question of why anyone would ever
-not use the Application View Cache. First, the technology
-currently does not invalidate itself if the page is modified;
-it requires a server restart. This makes it difficult to use
-during development. Beyond this, however, there are some
-JSF coding techniques that break the core assumption of
-the Application View Cache - the assumption that the initial
-view state of any one page is always the same, no matter who
-views it:
-<ol>
-<li>Conditional tags that may not evaluate identically for each user</li>
-<li>JSF components that pull EL results into page state</li>
-</ol>
-</p>
-<p>
-The following JSP includes two potential examples of the first problem:
-<source><![CDATA[
- <c:if test="${user.locale.language='en'}">
- <h:outputText value="You're in an English locale"/>
- </c:if>
-
- <tr:selectOneListbox value="#{someValue}">
- <tr:forEach var="item" items="#{model.listOfItems}">
- <tr:selectItem value="#{item.value}" text="#{item.text}"/>
- </tr:forEach>
- </tr:selectOneListbox>
-]]>
-</source>
-The <c:if> will show "You're in an English locale" if the locale's
-language is English. This means that in English, a user's version of
-the page will have an extra component over users who aren't
-using English; the state will vary accordingly. This sort of
-problem can cleanly be resolved by using "rendered" instead of <c:if>,
-which is always a recommended JSF best-practice:
-<source><![CDATA[
- <h:outputText value="You're in an English locale"
- rendered="#{user.locale.language == 'en'}"/>
-]]>
-</source>
-The example using <tr:forEach> is less clear-cut, and
-less easily resolved. If "model.listOfItems" always has the
-same <em>number</em> of items when a page gets shown at first,
-then there are no issues with this particular code sample. But
-if the number of items does vary from one user to another,
-then the page, as written, cannot support the Application View Cache.
-In this particular case, there's also a simple workaround:
-<source><![CDATA[
- <tr:selectOneListbox value="#{someValue}">
- <f:selectItems value="#{model.listOfSelectItems}"/>
- </tr:selectOneListbox>
-]]>
-</source>
-</p>
-<p>
-In addition to problems with non-JSF tags that manipulate the
-page, you can run into problems with some JSF tags that
-directly manipulate page state. A particular example of this
-is the MyFaces <x:save_state> tag. This tag will
-evaluate an EL expression and save it directly as part
-of the page's view state. This is very nice functionality,
-but it does directly and necessarily conflict with the
-technique of the Application View Cache.
-</p>
-
-
-<p>At the moment, the Application View Cache can only
-be enabled or disabled globally. We are considering
-adding support for disabling (or enabling) the view cache
-on a page-by-page basis.</p>
-
-</subsection>
</section>
<section name="RequestContext">
Propchange: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 3 22:21:28 2009
@@ -6,3 +6,4 @@
.classpath
.project
.settings
+*.jpr
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml?rev=886954&r1=886953&r2=886954&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml Thu Dec 3 22:21:28 2009
@@ -81,17 +81,6 @@
<param-value>true</param-value>
</context-param>
- <!-- Trinidad also supports an optimized strategy for caching some
- view state at an application level, which significantly improves
- scalability. However, it makes it harder to develop (updates to
- pages will not be noticed until the server is restarted), and in
- some rare cases cannot be used for some pages (see Trinidad
- documentation for more information) -->
- <context-param>
- <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
- <param-value>false</param-value>
- </context-param>
-
<!-- Temporarily disable partial state saving default until we make it work with Trinidad -->
<context-param>
Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?rev=886954&r1=886953&r2=886954&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Thu Dec 3 22:21:28 2009
@@ -18,10 +18,12 @@
*/
package org.apache.myfaces.trinidadinternal.application;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
+
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -37,27 +39,21 @@
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.faces.render.ResponseStateManager;
+import javax.faces.view.StateManagementStrategy;
+import javax.faces.view.ViewDeclarationLanguage;
+import org.apache.myfaces.trinidad.bean.util.StateUtils;
import org.apache.myfaces.trinidad.component.UIXComponentBase;
import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.context.Window;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.util.ExternalContextUtils;
-import org.apache.myfaces.trinidadinternal.util.LRUCache;
+import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
+import org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener;
import org.apache.myfaces.trinidadinternal.util.SubKeyMap;
import org.apache.myfaces.trinidadinternal.util.TokenCache;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-
-import javax.faces.view.StateManagementStrategy;
-import javax.faces.view.ViewDeclarationLanguage;
-
-import org.apache.myfaces.trinidad.bean.util.StateUtils;
-import org.apache.myfaces.trinidad.context.Window;
-import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
-import org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener;
-
/**
* StateManager that handles a hybrid client/server strategy: a
* SerializedView is stored on the server, and only a small token
@@ -91,9 +87,6 @@
*/
public class StateManagerImpl extends StateManagerWrapper
{
- static public final String USE_APPLICATION_VIEW_CACHE_INIT_PARAM =
- "org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE";
-
static public final String CACHE_VIEW_ROOT_INIT_PARAM =
"org.apache.myfaces.trinidad.CACHE_VIEW_ROOT";
@@ -290,41 +283,11 @@
return view;
UIViewRoot root = context.getViewRoot();
- boolean dontSave = false;
-
- // See if we're going to use the application view cache for
- // this request
- Map<String, PageState> applicationViewCache = null;
- Map<String, PageState> perSessionApplicationViewCache = null;
- if (_useApplicationViewCache(context))
- {
- // OK, we are: so find the application cache and
- // the per-session mirror
- applicationViewCache = _getApplicationViewCache(context);
- perSessionApplicationViewCache =
- _getPerSessionApplicationViewCache(context);
-
- synchronized (applicationViewCache)
- {
- // If we've already got a copy of the state stored, then
- // we just need to make sure it's mirrored on the session
- PageState applicationState = applicationViewCache.get(root.getViewId());
- if (applicationState != null)
- {
- // Note that we've got no work to do...
- dontSave = true;
- perSessionApplicationViewCache.put(root.getViewId(),
- applicationState);
- }
- }
- }
_removeTransientComponents(root);
- Object structure = (dontSave || !_needStructure(context))
- ? null
- : new Structure(root);
- Object state = dontSave ? null : root.processSaveState(context);
+ Object structure = !_needStructure(context) ? null : new Structure(root);
+ Object state = root.processSaveState(context);
if (_saveAsToken(context))
{
@@ -332,94 +295,71 @@
ExternalContext extContext = context.getExternalContext();
- if (applicationViewCache == null)
- {
- assert(!dontSave);
- TokenCache cache = _getViewCache(context);
- assert(cache != null);
+ TokenCache cache = _getViewCache(context);
+ assert(cache != null);
- Map<String, Object> sessionMap = extContext.getSessionMap();
+ Map<String, Object> sessionMap = extContext.getSessionMap();
- RequestContext trinContext = RequestContext.getCurrentInstance();
-
- // get view cache key with "." separator suffix to separate the SubKeyMap keys
- String subkey = _getViewCacheKey(extContext, trinContext, _SUBKEY_SEPARATOR);
-
- Map<String, PageState> stateMap = new SubKeyMap<PageState>(sessionMap, subkey);
+ RequestContext trinContext = RequestContext.getCurrentInstance();
+
+ // get view cache key with "." separator suffix to separate the SubKeyMap keys
+ String subkey = _getViewCacheKey(extContext, trinContext, _SUBKEY_SEPARATOR);
+
+ Map<String, PageState> stateMap = new SubKeyMap<PageState>(sessionMap, subkey);
- // Sadly, we can't save just a SerializedView, because we should
- // save a serialized object, and SerializedView is a *non*-static
- // inner class of StateManager
- PageState pageState = new PageState(
- context,
- structure,
- state,
- // Save the view root into the page state as a transient
- // if this feature has not been disabled
- _useViewRootCache(context) ? root : null);
-
- // clear out all of the previous PageStates' UIViewRoots and add this page
- // state as an active page state. This is necessary to avoid UIViewRoots
- // laying around if the user navigates off of a page using a GET
- synchronized(extContext.getSession(true))
- {
- // get the per-window key for the active page state
- String activePageStateKey = _getActivePageStateKey(extContext, trinContext);
- PageState activePageState = (PageState)sessionMap.get(activePageStateKey);
+ // Sadly, we can't save just a SerializedView, because we should
+ // save a serialized object, and SerializedView is a *non*-static
+ // inner class of StateManager
+ PageState pageState = new PageState(
+ context,
+ structure,
+ state,
+ // Save the view root into the page state as a transient
+ // if this feature has not been disabled
+ _useViewRootCache(context) ? root : null);
+
+ // clear out all of the previous PageStates' UIViewRoots and add this page
+ // state as an active page state. This is necessary to avoid UIViewRoots
+ // laying around if the user navigates off of a page using a GET
+ synchronized(extContext.getSession(true))
+ {
+ // get the per-window key for the active page state
+ String activePageStateKey = _getActivePageStateKey(extContext, trinContext);
+ PageState activePageState = (PageState)sessionMap.get(activePageStateKey);
- if (activePageState != null)
- activePageState.clearViewRootState();
+ if (activePageState != null)
+ activePageState.clearViewRootState();
- sessionMap.put(activePageStateKey, pageState);
- }
-
- String requestToken = _getRequestTokenForResponse(context);
- // If we have a cached token that we want to reuse,
- // and that token hasn't disappeared from the cache already
- // (unlikely, but not impossible), use the stateMap directly
- // without asking the cache for a new token
- if ((requestToken != null) && cache.isAvailable(requestToken))
- {
- // NOTE: under *really* high pressure, the cache might
- // have been emptied between the isAvailable() call and
- // this put(). This seems sufficiently implausible to
- // be worth punting on
- stateMap.put(requestToken, pageState);
- token = requestToken;
- // NOTE 2: we have not pinned this reused state to any old state
- // This is OK for current uses of pinning and state reuse,
- // as pinning stays constant within a window, and we're not
- // erasing pinning at all.
- }
- else
- {
- // See if we should pin this new state to any old state
- String pinnedToken = (String)extContext.getRequestMap().get(_PINNED_STATE_TOKEN_KEY);
- token = cache.addNewEntry(pageState,
- stateMap,
- pinnedToken);
- }
+ sessionMap.put(activePageStateKey, pageState);
+ }
+
+ String requestToken = _getRequestTokenForResponse(context);
+ // If we have a cached token that we want to reuse,
+ // and that token hasn't disappeared from the cache already
+ // (unlikely, but not impossible), use the stateMap directly
+ // without asking the cache for a new token
+ if ((requestToken != null) && cache.isAvailable(requestToken))
+ {
+ // NOTE: under *really* high pressure, the cache might
+ // have been emptied between the isAvailable() call and
+ // this put(). This seems sufficiently implausible to
+ // be worth punting on
+ stateMap.put(requestToken, pageState);
+ token = requestToken;
+ // NOTE 2: we have not pinned this reused state to any old state
+ // This is OK for current uses of pinning and state reuse,
+ // as pinning stays constant within a window, and we're not
+ // erasing pinning at all.
}
- // If we got the "applicationViewCache", we're using it.
else
{
- // use null viewRoot since this state is shared across users:
- PageState applicationState = new PageState(context, structure, state, null);
-
- // If we need to, stash the state off in our cache
- if (!dontSave)
- {
- synchronized (applicationViewCache)
- {
- applicationViewCache.put(root.getViewId(),
- applicationState);
- perSessionApplicationViewCache.put(root.getViewId(),
- applicationState);
- }
- }
-
- token = _APPLICATION_CACHE_TOKEN;
+ // See if we should pin this new state to any old state
+ String pinnedToken = (String)extContext.getRequestMap().get(_PINNED_STATE_TOKEN_KEY);
+ token = cache.addNewEntry(pageState,
+ stateMap,
+ pinnedToken);
}
+
assert(token != null);
@@ -432,7 +372,6 @@
}
else
{
- assert(!dontSave);
view = new SerializedView(structure, state);
}
@@ -563,7 +502,6 @@
{
final Object structure;
final Object state;
- boolean recalculateLocale = false;
ResponseStateManager rsm = _getResponseStateManager(context, renderKitId);
if (_saveAsToken(context))
@@ -578,64 +516,30 @@
assert(token instanceof String);
_LOG.finer("Restoring saved view state for token {0}", token);
- PageState viewState;
-
- // Load from the application cache
- if (_APPLICATION_CACHE_TOKEN.equals(token))
- {
- Map<String, PageState> cache = _getApplicationViewCache(context);
- Map<String, PageState> perSessionCache =
- _getPerSessionApplicationViewCache(context);
-
- // Synchronize on the application-level cache.
- // =-=AEW This may produce excessive contention
- synchronized (cache)
- {
- // Look first in the per-session cache
- viewState = perSessionCache.get(viewId);
- if (viewState == null)
- {
- // Nope, it's not there. Look in the application cache
- viewState = cache.get(viewId);
- // And if we find it there, then push it back into
- // the per-session cache (it may have expired)
- if (viewState != null)
- perSessionCache.put(viewId, viewState);
- }
-
- // If the view was found in the application cache then we
- // know it would be unsafe to use its locale for this session.
- // Same conclusion, however, even if found in the per-session
- // cache, since the latter is just a mirror of the former.
- recalculateLocale = true;
- }
- }
- else
- {
- // get view cache key with "." separator suffix to separate the SubKeyMap keys
- String subkey = _getViewCacheKey(extContext,
- RequestContext.getCurrentInstance(),
- _SUBKEY_SEPARATOR);
-
- Map<String, PageState> stateMap = new SubKeyMap<PageState>(
- extContext.getSessionMap(),
- subkey);
- viewState = stateMap.get(token);
-
- if (viewState != null)
- _updateRequestTokenForResponse(context, (String) token);
-
- // Make sure that if the view state is present, the cache still
- // has the token, and vice versa
-
- // NOTE: it's very important that we call through to the
- // token cache here, not just inside the assert. If we don't,
- // then we don't actually access the token, so it doesn't
- // get bumped up to the front in the LRU Cache!
- boolean isAvailable =
- _getViewCache(context).isAvailable((String) token);
- assert ((viewState != null) == isAvailable);
- }
+
+ // get view cache key with "." separator suffix to separate the SubKeyMap keys
+ String subkey = _getViewCacheKey(extContext,
+ RequestContext.getCurrentInstance(),
+ _SUBKEY_SEPARATOR);
+
+ Map<String, PageState> stateMap = new SubKeyMap<PageState>(
+ extContext.getSessionMap(),
+ subkey);
+ PageState viewState = stateMap.get(token);
+
+ if (viewState != null)
+ _updateRequestTokenForResponse(context, (String) token);
+
+ // Make sure that if the view state is present, the cache still
+ // has the token, and vice versa
+
+ // NOTE: it's very important that we call through to the
+ // token cache here, not just inside the assert. If we don't,
+ // then we don't actually access the token, so it doesn't
+ // get bumped up to the front in the LRU Cache!
+ boolean isAvailable =
+ _getViewCache(context).isAvailable((String) token);
+ assert ((viewState != null) == isAvailable);
if (viewState == null)
{
@@ -691,13 +595,7 @@
((Structure) structure).createComponent();
if (state != null)
- root.processRestoreState(context, state);
-
- if (recalculateLocale)
- {
- // Ensure that locale gets re-calculated when next fetched.
- root.setLocale((Locale) null);
- }
+ root.processRestoreState(context, state);
_LOG.finer("Restored state for view \"{0}\"", viewId);
return root;
@@ -902,97 +800,7 @@
return _DEFAULT_CACHE_SIZE;
}
-
- //
- // @todo Map is a bad structure
- // @todo a static size is bad
- //
- @SuppressWarnings("unchecked")
- static private Map<String, PageState> _getApplicationViewCache(FacesContext context)
- {
- synchronized (_APPLICATION_VIEW_CACHE_LOCK)
- {
- Map<String, Object> appMap = context.getExternalContext().getApplicationMap();
- Map<String, PageState> cache = (Map<String, PageState>)appMap.get(_APPLICATION_VIEW_CACHE_KEY);
- if (cache == null)
- {
- cache = new HashMap<String, PageState>(128);
- appMap.put(_APPLICATION_VIEW_CACHE_KEY, cache);
- }
-
- return cache;
- }
- }
- @SuppressWarnings("unchecked")
- static private Map<String, PageState> _getPerSessionApplicationViewCache(FacesContext context)
- {
- ExternalContext external = context.getExternalContext();
- Object session = external.getSession(true);
- assert(session != null);
-
- Map<String, PageState> cache;
- // Synchronize on the session object to ensure that
- // we don't ever create two different caches
- synchronized (session)
- {
- Map<String, Object> sessionMap = external.getSessionMap();
- cache = (Map<String, PageState>) sessionMap.get(_APPLICATION_VIEW_CACHE_KEY);
- if (cache == null)
- {
- cache = _createPerSessionApplicationViewCache();
- sessionMap.put(_APPLICATION_VIEW_CACHE_KEY, cache);
- }
- }
-
- return cache;
- }
-
- //
- // For the per-session mirror of the application view cache,
- // use an LRU LinkedHashMap to store the latest 16 pages.
- //
- static private Map<String, PageState> _createPerSessionApplicationViewCache()
- {
- return new LRUCache<String, PageState>(_MAX_PER_SESSION_APPLICATION_SIZE);
- }
-
- static private final int _MAX_PER_SESSION_APPLICATION_SIZE = 16;
-
- //
- // Use the application view cache if and only if:
- // (1) We're saving state tokens on the client
- // (2) This is *not* a postback request
- // (3) The feature has been explicitly enabled
- //
- private boolean _useApplicationViewCache(FacesContext context)
- {
- if (_useApplicationViewCache == Boolean.FALSE)
- return false;
-
- if (_saveAsToken(context) &&
- // Note: do not use TrinidadPhaseListener, as that
- // will return "true" even after navigation has occured,
- // but the Application View Cache is still fine.
- //!TrinidadPhaseListener.isPostback(context)
- !RequestContext.getCurrentInstance().isPostback())
- {
- if (_useApplicationViewCache == null)
- {
- String s = context.getExternalContext().getInitParameter(
- USE_APPLICATION_VIEW_CACHE_INIT_PARAM);
- _useApplicationViewCache =
- "true".equalsIgnoreCase(s) ? Boolean.TRUE : Boolean.FALSE;
- }
- if (Boolean.TRUE.equals(_useApplicationViewCache))
- {
- _LOG.severe("USE_APPLICATION_VIEW_CACHE_UNSUPPORTED");
- }
- return _useApplicationViewCache.booleanValue();
- }
-
- return false;
- }
private boolean _useViewRootCache(FacesContext context)
{
@@ -1267,22 +1075,16 @@
private final StateManager _delegate;
private Boolean _useViewRootCache;
- private Boolean _useApplicationViewCache;
private Boolean _structureGeneratedByTemplate;
private static final Character _SUBKEY_SEPARATOR = new Character('.');
private static final int _DEFAULT_CACHE_SIZE = 15;
-
- private static final Object _APPLICATION_VIEW_CACHE_LOCK = new Object();
// base key used to identify the view cache. The window name, if any, is appended to this
private static final String _VIEW_CACHE_KEY =
"org.apache.myfaces.trinidadinternal.application.VIEW_CACHE";
- private static final String _APPLICATION_VIEW_CACHE_KEY =
- "org.apache.myfaces.trinidadinternal.application.APPLICATION_VIEW_CACHE";
-
private static final String _CACHED_SERIALIZED_VIEW =
"org.apache.myfaces.trinidadinternal.application.CachedSerializedView";
@@ -1299,8 +1101,6 @@
private static final String _ACTIVE_PAGE_STATE_SESSION_KEY =
"org.apache.myfaces.trinidadinternal.application.StateManagerImp.ACTIVE_PAGE_STATE";
- private static final String _APPLICATION_CACHE_TOKEN = "_a_";
-
private static final long serialVersionUID = 1L;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(StateManagerImpl.class);