Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


oracle.dss.thin.beans.graph
Class GraphPool

java.lang.Object
  |
  +--oracle.dss.thin.beans.graph.PoolDispatcher
        |
        +--oracle.dss.thin.beans.graph.GraphPool

public class GraphPool
extends PoolDispatcher

GraphPool can be used to manage a dynamically growing pool of graph objects. By reusing pooled graphs to render images for multiple users applications can improve scalability without sacrificing performance. GraphPool is built with an assumption that application does not hold on to the checked out instances, and that they are returned after a relatively short period of time.

To use a pooling service, application will need to instantiate GraphPool as a static variable or Servlet instance variable. Here is what happens when an instance of ThinGraph is needed to perform rendering:

  1. getThinGraph() is called on the pooling service
  2. ThinGraph instance is configured
  3. Rendering is performed
  4. Instance is returned to the pool by calling release()


It is good idea to perform steps 3 and 4 within a try{} block, and step 4 within finally{} to ensure that graphs get released even if some exceptions are thrown.

If used with GraphBean, an instance of ThinGraph should be provided to it as a BoundValue:

 //when UIX Component tree is constructed:
 GraphBean graphNode = new GraphBean();
 GraphNode.setGraphBinding(NAMESPACE, DATATANAME, GRAPH_SELECT_KEY);
 
 //when the UINode tree is rendered:
 ThinGraph graph = m_pool.getThinGraph();
 DictionaryData data = new DictionaryData();
 data.put(GRAPH_SELECT_KEY, graph);
 renderingContext.setDataObject(NAMESPACE, DATATANAME, data); 




Application can customize pool is created and growing. The optimal parameters will depend on the number of concurrent requests and time needed to configure graph and perform rendering.

Loading Objects from BI Beans Catalog

An instance of graph retrieved from a pool can be initialized with a graph definition stored within BI Beans Catalog. PersistenceNanager exposes a set of lookup() methods that take Persistable as a second parameter. To load graph definition into a pooled instance, supply it as Persistable to the lookup() call.

Maintaining Session State

Application might choose to cache graph settings and data source loaded from BI Beans Catalogue. Since pooled graph objects are reused across user sessions, settings and data sources that are session-specific have to be stored independently from graph instances. Consider the following example:

 
 //retrieve graph from the pool
 ThinGraph graph = m_graphPool.getThinGraph();
 //load graph definition
 persistanceManager.lookup("folder/mygraph", graph);
 
 //get graph settings and its datasource
 String xml = graph.getXMLAsString();
 DataSource ds = graph.getDataSource();
 
 //store session-specific settings and data source on HTTP session:
 httpSession.setAttribute(GRAPH_XML, xml);
 httpSession.setAttribute(GRAPH_DATASOURCE, ds);



Fields inherited from class oracle.dss.thin.beans.graph.PoolDispatcher
DEF_INITIAL_SIZE, DEF_INSTANCE_INCR, DEF_MAX_SIZE, DEF_NORM_SIZE, DEF_QUEUE_RATIO

 

Constructor Summary
GraphPool()
          Default Constructor.
GraphPool(java.lang.ClassLoader threadClassLoader)
          Constructor.
GraphPool(int init_size, int norm_size, int max_size, int inst_incr, float queue_ratio)
          Constructor.
GraphPool(int init_size, int norm_size, int max_size, int inst_incr, float queue_ratio, java.lang.ClassLoader threadClassLoader)
          Constructor.

 

Method Summary
 ThinGraph getThinGraph()
          Retrieves an instance of ThinGraph from a pool.
 void release(java.lang.Object obj)
          Returns a thin graph to the pool after resetting all of its properties
 void release(java.lang.Object obj, boolean fReset)
          Returns a thin graph to the pool

 

Methods inherited from class oracle.dss.thin.beans.graph.PoolDispatcher
cleanup, dump, get

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

GraphPool

public GraphPool()
Default Constructor. Creates ThinGraph pool dispatcher with default configuration parameters
See Also:
PoolDispatcher.DEF_INITIAL_SIZE, PoolDispatcher.DEF_NORM_SIZE, PoolDispatcher.DEF_MAX_SIZE, PoolDispatcher.DEF_INSTANCE_INCR, PoolDispatcher.DEF_QUEUE_RATIO

GraphPool

public GraphPool(java.lang.ClassLoader threadClassLoader)
Constructor. Creates ThinGraph pool dispatcher with default configuration parameters and a specified class loader for the thread that allocates new Graphs
Parameters:
threadClassLoader - class loader used in the thread that allocates new Graphs
See Also:
PoolDispatcher.DEF_INITIAL_SIZE, PoolDispatcher.DEF_NORM_SIZE, PoolDispatcher.DEF_MAX_SIZE, PoolDispatcher.DEF_INSTANCE_INCR, PoolDispatcher.DEF_QUEUE_RATIO

GraphPool

public GraphPool(int init_size,
                 int norm_size,
                 int max_size,
                 int inst_incr,
                 float queue_ratio,
                 java.lang.ClassLoader threadClassLoader)
Constructor. Creates pool dispatcher
Parameters:
init_size - The number of pooled objects allocated when pool is created
norm_size - The number of pooled objects that should remain allocated when there are no outstanding requests
max_size - Maximum number of pooled objects to be allocated
inst_incr - Number of instances allocated at once when pool is growing
queue_ratio - A ratio between the number of outstanding requests and and the total number of pooled obejcts when the pool should start growing
threadClassLoader - class loader used in the thread that allocates new Graphs

GraphPool

public GraphPool(int init_size,
                 int norm_size,
                 int max_size,
                 int inst_incr,
                 float queue_ratio)
Constructor. Creates pool dispatcher
Parameters:
init_size - The number of pooled objects allocated when pool is created
norm_size - The number of pooled objects that should remain allocated when there are no outstanding requests
max_size - Maximum number of pooled objects to be allocated
inst_incr - Number of instances allocated at once when pool is growing
queue_ratio - A ratio between the number of outstanding requests and and the total number of pooled obejcts when the pool should start growing
Method Detail

getThinGraph

public ThinGraph getThinGraph()
Retrieves an instance of ThinGraph from a pool.
Returns:
pooled ThinGraph

release

public void release(java.lang.Object obj)
Returns a thin graph to the pool after resetting all of its properties
Overrides:
release in class PoolDispatcher
Parameters:
An - instance of graph to be returned

release

public void release(java.lang.Object obj,
                    boolean fReset)
Returns a thin graph to the pool
Parameters:
obj - An instance of graph to be returned
fReset - A flag indicating whether all graph properties should be reset to defaults

Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


Copyright © 2003, Oracle. All Rights Reserved.