Class ViewPool
- java.lang.Object
- 
- org.apache.myfaces.view.facelets.pool.ViewPool
 
- 
- Direct Known Subclasses:
- ViewPoolImpl
 
 public abstract class ViewPool extends Object This class defines the necessary operations that a view pool should comply in order to be used by MyFaces.A View Pool is a set of initialized views that are kept ready to use. The idea is reset and reuse views taking advantage of existing Faces 2.0 Partial State Saving algorithm with some small additions to component's saveState() method. This technique works by these reasons: - A view is composed by many small objects that are created multiple times per each request, and the time spent creating these objects is usually larger than the time used to traverse the component tree.
- The structure of a view usually does not change over application lifetime.
- The "delta state" or in other words the elements that change in view are small compared with the elements that does not change.
 The implementation proposed uses a lock free view pool structure with soft or weak references. The lock free view pool ensures fast access and the soft or weak references ensured the garbage collection algorithm is not affected by the view pool. - Author:
- Leonardo Uribe
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringENTRY_MODE_SOFTstatic StringENTRY_MODE_WEAKstatic StringINIT_PARAM_VIEW_POOL_DEFERRED_NAVIGATIONDefines if the view pool uses deferred navigation to recycle views when navigation is performed.static StringINIT_PARAM_VIEW_POOL_ENTRY_MODEDefines the type of memory reference that is used to hold the view into memory.static StringINIT_PARAM_VIEW_POOL_ENTRY_MODE_DEFAULTstatic StringINIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMITDefines the limit of the views that cannot be reused partially.static intINIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMIT_DEFAULTstatic StringINIT_PARAM_VIEW_POOL_MAX_POOL_SIZEDefines the number of views to be hold per each view metadata definition.static intINIT_PARAM_VIEW_POOL_MAX_POOL_SIZE_DEFAULT
 - 
Constructor SummaryConstructors Constructor Description ViewPool()
 - 
Method Summary
 
- 
- 
- 
Field Detail- 
INIT_PARAM_VIEW_POOL_MAX_POOL_SIZE@JSFWebConfigParam(defaultValue="5", tags="performance") public static final String INIT_PARAM_VIEW_POOL_MAX_POOL_SIZEDefines the number of views to be hold per each view metadata definition. By default is 5. Usually a view is defined by its viewId, locale, renderKitId and active contracts. If a view shares the same values for these parameters belongs to the same group that can be pooled.- See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_MAX_POOL_SIZE_DEFAULTpublic static final int INIT_PARAM_VIEW_POOL_MAX_POOL_SIZE_DEFAULT - See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMIT@JSFWebConfigParam(defaultValue="2", tags="performance") public static final String INIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMITDefines the limit of the views that cannot be reused partially.- See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMIT_DEFAULTpublic static final int INIT_PARAM_VIEW_POOL_MAX_DYNAMIC_PARTIAL_LIMIT_DEFAULT - See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_ENTRY_MODE@JSFWebConfigParam(defaultValue="soft", expectedValues="weak,soft", tags="performance") public static final String INIT_PARAM_VIEW_POOL_ENTRY_MODEDefines the type of memory reference that is used to hold the view into memory. By default a "soft" reference is used.- See Also:
- Constant Field Values
 
 - 
ENTRY_MODE_SOFTpublic static final String ENTRY_MODE_SOFT - See Also:
- Constant Field Values
 
 - 
ENTRY_MODE_WEAKpublic static final String ENTRY_MODE_WEAK - See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_ENTRY_MODE_DEFAULTpublic static final String INIT_PARAM_VIEW_POOL_ENTRY_MODE_DEFAULT - See Also:
- Constant Field Values
 
 - 
INIT_PARAM_VIEW_POOL_DEFERRED_NAVIGATION@JSFWebConfigParam(defaultValue="false", expectedValues="true, false", tags="performance") public static final String INIT_PARAM_VIEW_POOL_DEFERRED_NAVIGATIONDefines if the view pool uses deferred navigation to recycle views when navigation is performed. The difference is a normal navigation is not done when the broadcast is done but at the end of invoke application phase.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
isDeferredNavigationEnabledpublic abstract boolean isDeferredNavigationEnabled() Indicate if the view pool uses deferred navigation.- Returns:
 
 - 
storeStaticViewStructureMetadatapublic abstract void storeStaticViewStructureMetadata(FacesContext context, UIViewRoot root, FaceletState faceletState) 
 - 
retrieveStaticViewStructureMetadatapublic abstract ViewStructureMetadata retrieveStaticViewStructureMetadata(FacesContext context, UIViewRoot root) 
 - 
pushStaticStructureViewpublic abstract void pushStaticStructureView(FacesContext context, UIViewRoot root) 
 - 
pushPartialStructureViewpublic abstract void pushPartialStructureView(FacesContext context, UIViewRoot root) 
 - 
popStaticOrPartialStructureViewpublic abstract ViewEntry popStaticOrPartialStructureView(FacesContext context, UIViewRoot root) 
 - 
isWorthToRecycleThisViewpublic abstract boolean isWorthToRecycleThisView(FacesContext context, UIViewRoot root) 
 - 
storeDynamicViewStructureMetadatapublic abstract void storeDynamicViewStructureMetadata(FacesContext context, UIViewRoot root, FaceletState faceletState) 
 - 
retrieveDynamicViewStructureMetadatapublic abstract ViewStructureMetadata retrieveDynamicViewStructureMetadata(FacesContext context, UIViewRoot root, FaceletState faceletState) 
 - 
pushDynamicStructureViewpublic abstract void pushDynamicStructureView(FacesContext context, UIViewRoot root, FaceletState faceletDynamicState) 
 - 
popDynamicStructureViewpublic abstract ViewEntry popDynamicStructureView(FacesContext context, UIViewRoot root, FaceletState faceletDynamicState) 
 
- 
 
-