Class UifViewPool
The initial creation of the view object from Spring can be expensive in certain cases. To help with this, views can be preloaded with this pool class. When a request for a new view instance is made, a check will be done first to see if there is a pool and if so pull the already loaded view
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddViewInstance(View view) Adds a view instance to the poolintMaximum number of view instances the pool can holdRetrieves a view instance from the pool and removes the instanceRetrieves a view instance from the pool without removing itbooleanisEmpty()Indicates whether the pool is empty (contains no view instances)booleanisFull()Indicates whether the pool is full (number of view instances equals configured max size)voidsetMaxSize(int maxSize) Setter for the pool max size
-
Constructor Details
-
UifViewPool
public UifViewPool() -
UifViewPool
public UifViewPool(int maxSize)
-
-
Method Details
-
getMaxSize
public int getMaxSize()Maximum number of view instances the pool can holdOn initial startup of the application (during dictionary loading), view instances will be loaded and filled in a pool up to the max size configuration. The default is to preload one view, and each time the view is retrieved it is replaced. If a request is made before the view is replaced, the view is rebuilt from Spring. Therefore the performance gain is not present. For views with high concurrency, this property can be tweaked as needed. Please note larger pool sizes cost more in memory storage and application start up time
- Returns:
- int max pool size
-
setMaxSize
public void setMaxSize(int maxSize) Setter for the pool max size- Parameters:
maxSize-
-
addViewInstance
Adds a view instance to the pool- Parameters:
view- - view instance to add
-
getViewInstance
Retrieves a view instance from the pool and removes the instance- Returns:
- View instance
-
isFull
public boolean isFull()Indicates whether the pool is full (number of view instances equals configured max size)- Returns:
- boolean true if pool is full, else if not
-
isEmpty
public boolean isEmpty()Indicates whether the pool is empty (contains no view instances)When the pool is empty, no view instances may be retrieved until the pool requires view instances. The calling code may choose to wait for a period of time and check again, or request a view instance from Spring
- Returns:
- boolean true if the pool is empty, false if not
-