Skip navigation links


com.essbase.eas.server.dao.jdbc.dbPool
Class AbstractResourcePool

java.lang.Object
  extended by java.lang.Thread
      extended by com.essbase.eas.server.dao.jdbc.dbPool.AbstractResourcePool

All Implemented Interfaces:
ResourcePool, java.lang.Runnable
Direct Known Subclasses:
DatabaseConnectionPool

public abstract class AbstractResourcePool
extends java.lang.Thread
implements ResourcePool

Nested Class Summary

 

Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler

 

Field Summary

 

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY

 

Constructor Summary
AbstractResourcePool()
           
AbstractResourcePool(java.util.Properties resourceCreationProps)
           
AbstractResourcePool(java.util.Properties resourceCreationProps, int resourcePoolSize)
           
AbstractResourcePool(java.util.Properties resourceCreationProps, int resourcePoolSize, long sleepInterval)
           

 

Method Summary
 void closeAll()
          Closes all the resources in the pool.
 java.util.Properties getCreationProperties()
           
static ResourcePool getPool(java.lang.Class poolType)
          Gets the resource pool allocated to the objects of type 'poolType'.
 int getPoolSize()
          Returns the number of resources allocated to the pool
 Resource getResource()
          This method returns a Resource by first looking into the pool and if no valid resource is found in the pool then it creates a new resource and returns it.
 long getSleepTimeInMillis()
          Returns the sleep interval.
 void initPool()
           
 void printStatus()
          Writes pool status information to the standard output stream i.e.
 void printStatus(java.io.PrintStream out)
          Writes pool status information to output stream passed as parameter
 void recycleResource(Resource resource)
          Validates and puts the resource in the resource pool.
 void run()
          Monitors the resource pool on regular intervals and check for the validity of the resources pushed inside the pool.
 void setCreationProperties(java.util.Properties props)
          Sets the properties required to create resources for the pool
 void setPoolSize(int size)
          Sets the the number of resources that should be allocated to the pool
 void setSleepTimeInMillis(long millis)
          Sets the sleep interval.

 

Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield

 

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

 

Methods inherited from interface com.essbase.eas.server.dao.jdbc.dbPool.ResourcePool
createResource

 

Constructor Detail

AbstractResourcePool

public AbstractResourcePool()
                     throws DataAccessException
Throws:
DataAccessException

AbstractResourcePool

public AbstractResourcePool(java.util.Properties resourceCreationProps)
                     throws DataAccessException
Throws:
DataAccessException

AbstractResourcePool

public AbstractResourcePool(java.util.Properties resourceCreationProps,
                            int resourcePoolSize)
                     throws DataAccessException
Throws:
DataAccessException

AbstractResourcePool

public AbstractResourcePool(java.util.Properties resourceCreationProps,
                            int resourcePoolSize,
                            long sleepInterval)
                     throws DataAccessException
Throws:
DataAccessException

Method Detail

initPool

public void initPool()
              throws DataAccessException
Throws:
DataAccessException

setCreationProperties

public void setCreationProperties(java.util.Properties props)
Sets the properties required to create resources for the pool
Parameters:
props -

getResource

public Resource getResource()
                     throws DataAccessException
This method returns a Resource by first looking into the pool and if no valid resource is found in the pool then it creates a new resource and returns it.
Returns:
A usable resource
Throws:
DataAccessException

setSleepTimeInMillis

public void setSleepTimeInMillis(long millis)
Sets the sleep interval. This thread will check for the validity of the resources inside the pool every 'millis' milliseconds and if invalid resources are found inside then they will be terminated and replaced with valid resources.
Parameters:
millis -

getSleepTimeInMillis

public long getSleepTimeInMillis()
Returns the sleep interval.
Returns:

setPoolSize

public void setPoolSize(int size)
Sets the the number of resources that should be allocated to the pool
Parameters:
number - of resources

getPoolSize

public int getPoolSize()
Returns the number of resources allocated to the pool
Returns:
number of resources allocated to the pool

getCreationProperties

public java.util.Properties getCreationProperties()
Returns:
the properties used to create resources for the pool

getPool

public static ResourcePool getPool(java.lang.Class poolType)
                            throws DataAccessException
Gets the resource pool allocated to the objects of type 'poolType'.
Returns:
resource pool.
Throws:
DataAccessException

closeAll

public void closeAll()
Closes all the resources in the pool. If subclasses need to close additional resources then override this method.

recycleResource

public void recycleResource(Resource resource)
                     throws DataAccessException
Validates and puts the resource in the resource pool.
Specified by:
recycleResource in interface ResourcePool
Parameters:
resource. -
Throws:
DataAccessException

printStatus

public void printStatus()
Writes pool status information to the standard output stream i.e. System.out

printStatus

public void printStatus(java.io.PrintStream out)
Writes pool status information to output stream passed as parameter
Parameters:
output - stream

run

public void run()
Monitors the resource pool on regular intervals and check for the validity of the resources pushed inside the pool. If any resource is no longer valid then it will be replaced.
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.