public class UifViewPool extends Object
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
UifDictionaryIndex.getViewById(java.lang.String)
Constructor and Description |
---|
UifViewPool() |
UifViewPool(int maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
addViewInstance(View view)
Adds a view instance to the pool
|
int |
getMaxSize()
Maximum number of view instances the pool can hold
|
View |
getViewInstance()
Retrieves a view instance from the pool and removes the instance
|
View |
getViewSharedInstance()
Retrieves a view instance from the pool without removing it
|
boolean |
isEmpty()
Indicates whether the pool is empty (contains no view instances)
|
boolean |
isFull()
Indicates whether the pool is full (number of view instances equals configured max size)
|
void |
setMaxSize(int maxSize)
Setter for the pool max size
|
public UifViewPool()
public UifViewPool(int maxSize)
public int getMaxSize()
On 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
public void setMaxSize(int maxSize)
maxSize
- public void addViewInstance(View view)
view
- - view instance to addpublic View getViewInstance()
public View getViewSharedInstance()
public boolean isFull()
public boolean isEmpty()
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
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.