oracle.ias.cache
Class PoolAccess

java.lang.Object
  |
  +--oracle.ias.cache.PoolAccess

public class PoolAccess
extends java.lang.Object

PoolAccess provides the cache pooling API. A pool is a special collection of objects managed by the cache. It is a set of identical object instances. Objects within a pool are instanciated by the cache system using a user defined factory object. Attributes such as "time to live", "idle time" or CacheEventListener may be associated with a pool. The time out attributes are applied to the objects within the pool. The listener is associated with the pool as a whole. See the Attributes class for more detail on how attributes are applied to a pool. A minimum and maximum size of the pool can be specified when the pool is created.

Since:
2.0.0
See Also:
Attributes

Method Summary
TypeMethod
 void close()
          releases the PoolAccess object.
 java.lang.Object get()
          gets an object from the pool.
static PoolAccess getPool(java.lang.String name)
          returns a PoolAccess object associated with the pool name in the default region.
static PoolAccess getPool(java.lang.String region, java.lang.String name)
          a static method that returns a PoolAccess object to access the pool in a region.
 void returnToPool()
          returns the object to the pool.
 java.lang.String toString()
          dumps the contents of the pool for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPool

public static PoolAccess getPool(java.lang.String name)
                          throws NotAPoolException,
                                 ObjectNotFoundException,
                                 CacheException
returns a PoolAccess object associated with the pool name in the default region. The PoolAccess object can then be used to retrieve an instance from the pool. Before calling this method, the pool must be created by calling CacheAccess.createPool().
Parameters:
name - the name of the pool
Returns:
a PoolAccess object associated with the pool
Throws:
NotAPoolException - If name doesn't refer to a pool in the specified region
ObjectNotFoundException - If name is not in the cache
CacheException - if any other error occurs
Since:
2.0.0
See Also:
CacheAccess.createPool

getPool

public static PoolAccess getPool(java.lang.String region,
                                 java.lang.String name)
                          throws NotAPoolException,
                                 ObjectNotFoundException,
                                 CacheException
a static method that returns a PoolAccess object to access the pool in a region. getPool returns a PoolAccess object associated with the pool name in the region. The PoolAccess object can then be used to retrieve an instance from the pool. Before calling this method, the pool must be created by calling CacheAccess.createPool().
Parameters:
region - the region of the pool
name - the name of the pool
Returns:
a PoolAccess object associated with the pool
Throws:
NotAPoolException - If name doesn't refer to a pool in the specified region
ObjectNotFoundException - If name is not in the cache
CacheException - if any other error occurs
Since:
2.0.0
See Also:
CacheAccess.createPool

close

public void close()
           throws CacheException
releases the PoolAccess object. Any attempts to use a PoolAccess object after close has been called will result in a InvalidHandleException.
Throws:
CacheException - if any error occurs.
Since:
2.0.0

get

public java.lang.Object get()
                     throws NoObjectAvailableException,
                            CacheException
gets an object from the pool. the get method will return an instance of a pooled objects. Only one instance of an object can be associated with a PoolAccess object at a time. The pooled object will be created automatically using the factory object associated with the pool if the object is not currently available in the pool and the maximum size of the pool has not been reached. If max is reached and all objects in the pooled are in use, a NoObjectAvailableException will be thrown.
Returns:
a pooled object associated with the PoolAccess, if it is called multiple times on the same PoolAccess object, the same pooled object will be returned.
Throws:
NoObjectAvailableException - if no more object is available
CacheException - if any other error occurs
Since:
2.0.0

returnToPool

public void returnToPool()
returns the object to the pool. returnToPool returns the object associated with the PoolAccess object to the pool. the same PoolAccess object can then be used to get a new pooled object.
Since:
2.0.0

toString

public java.lang.String toString()
dumps the contents of the pool for debugging.
Overrides:
toString in class java.lang.Object
Returns:
a string containing the info inside the pool.
Since:
2.0.0