org.kuali.rice.krad.datadictionary.uif
Class UifViewPool

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.uif.UifViewPool

public class UifViewPool
extends Object

Holds preloaded view instances up to a configured size

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:
UifDictionaryIndex.getViewById(java.lang.String)

Constructor Summary
UifViewPool()
           
UifViewPool(int maxSize)
           
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UifViewPool

public UifViewPool()

UifViewPool

public UifViewPool(int maxSize)
Method Detail

getMaxSize

public int getMaxSize()
Maximum number of view instances the pool can hold

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

Returns:
int max pool size

setMaxSize

public void setMaxSize(int maxSize)
Setter for the pool max size

Parameters:
maxSize -

addViewInstance

public void addViewInstance(View view)
Adds a view instance to the pool

Parameters:
view - - view instance to add

getViewInstance

public View getViewInstance()
Retrieves a view instance from the pool and removes the instance

Returns:
View instance

getViewSharedInstance

public View getViewSharedInstance()
Retrieves a view instance from the pool without removing it

Returns:
instance of a View

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


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.