Saturday, 18 April 2015

ADF Basics - Memory scope

Here I am documenting Information on ADF Memory scopes which Frank Nimphius explained in ADF insider tutorial series for my quick reference.


ADF Memory scopes
There are 6 types of memory scopes
3 from standard JSF application
  1. Application Scope 2)Session scope 3)request scope
In addition to above ADF Faces provides the following
4) PageFlowScope  5)backingBeanscope 6) ViewScope
Application Scope :
- Attributes and managed beans are available for an entire application and shared among users.
- Information should not have session dependency.
- This scope may be used to hold static objects that are the same for all users.
Session Scope:  
- Attributes and beans are user instance specific, and exists from the
 time of their creation to the time they are deleted or the session ends
- Example usecase is a user info bean that stores information about a user
 to avoid unnecessary queries.


Page flow Scope:
- Available for the duration of a task flow
- Exited when exiting the task flow
- If used with nested task flows, the Page Flow Scope of the caller flow
  is suspended and activated upon return from the called Task Flow
- PageFlow scope is not available until after the JavaServer Faces Restore View phase
A pageFlow scope exists for each task flow instance and has a lifespan between request and session scope. The lifetime of the scope spans across all pages in a bounded task flow.The object is available as long as the user continues navigating from one page to another. If the user opens a new browser window and begins navigating, that series of windows will have its own pageFlowScope scope.
View Scope
- Stores objects used by a single page
- Automatically released when the user leaves the page
- A View scope instance exists for each view that the ADF Controller manages
- The lifetime begins and ends with the change of the view id of a view port


Request scope:
- Represents the smallest available scope
- Lasts for the time it takes to transition from one view activity to the next
The object is available from the time an HTTP request is made until a response is sent back to the client. Use request scope when the managed bean does not need to persist longer than the current request. From another perspective, a request scope starts with a request to be issued from one view to another for navigation cases that don't perform a redirect but a default server-side forward. The scope spans across all non-view activities that follow the view of interest to the next view activity.
Backing bean scope:
- Special case of request scope
- Associated with a specific manage bean instance
- Used with declarative components,regions and page fragments that use a
 managed bean to hold view state information
- Allows multiple instances of the components to co-exists on a single page
Use this scope if it is possible that your task flow appears in two ADF regions on the same JSF page and you want to isolate each instance of ADF region


None
- Use for beans that don't require to keep state so that bean does not need

to remain in memory

No comments:

Post a Comment