Java Doc for GenericKeyedObjectPool.java in  » Database-JDBC-Connection-Pool » Apache-commons-pool-1.3 » org » apache » commons » pool » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » Apache commons pool 1.3 » org.apache.commons.pool.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.pool.BaseKeyedObjectPool
      org.apache.commons.pool.impl.GenericKeyedObjectPool

GenericKeyedObjectPool
public class GenericKeyedObjectPool extends BaseKeyedObjectPool implements KeyedObjectPool(Code)
A configurable KeyedObjectPool implementation.

When coupled with the appropriate KeyedPoolableObjectFactory , GenericKeyedObjectPool provides robust pooling functionality for arbitrary objects.

A GenericKeyedObjectPool provides a number of configurable parameters:

Optionally, one may configure the pool to examine and possibly evict objects as they sit idle in the pool. This is performed by an "idle object eviction" thread, which runs asychronously. The idle object eviction thread may be configured using the following attributes:

GenericKeyedObjectPool is not usable without a KeyedPoolableObjectFactory . A non-null factory must be provided either as a constructor argument or via a call to GenericKeyedObjectPool.setFactory before the pool is used.


See Also:   GenericObjectPool
author:
   Rodney Waldhoff
author:
   Dirk Verbeeck
version:
   $Revision: 386116 $ $Date: 2006-03-15 12:15:58 -0500 (Wed, 15 Mar 2006) $

Inner Class :static class ObjectTimestampPair implements Comparable
Inner Class :public static class Config

Field Summary
final public static  intDEFAULT_MAX_ACTIVE
     The default cap on the total number of active instances from the pool (per key).
final public static  intDEFAULT_MAX_IDLE
     The default cap on the number of idle instances in the pool (per key).
final public static  intDEFAULT_MAX_TOTAL
     The default cap on the the maximum number of objects that can exists at one time.
final public static  longDEFAULT_MAX_WAIT
     The default maximum amount of time (in millis) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.getWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK .
final public static  longDEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
     The default value for GenericKeyedObjectPool.getMinEvictableIdleTimeMillis .
final public static  intDEFAULT_MIN_IDLE
     The default minimum level of idle objects in the pool.
final public static  intDEFAULT_NUM_TESTS_PER_EVICTION_RUN
     The default number of objects to examine per run in the idle object evictor.
final public static  booleanDEFAULT_TEST_ON_BORROW
     The default "test on borrow" value.
final public static  booleanDEFAULT_TEST_ON_RETURN
     The default "test on return" value.
final public static  booleanDEFAULT_TEST_WHILE_IDLE
     The default "test while idle" value.
final public static  longDEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
     The default "time between eviction runs" value.
final public static  byteDEFAULT_WHEN_EXHAUSTED_ACTION
     The default "when exhausted action" for the pool.
final public static  byteWHEN_EXHAUSTED_BLOCK
     A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should block until a new object is available, or the GenericKeyedObjectPool.getMaxWait maximum wait time has been reached.
final public static  byteWHEN_EXHAUSTED_FAIL
     A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should fail, throwing a NoSuchElementException .
final public static  byteWHEN_EXHAUSTED_GROW
     A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should simply create a new object anyway.

Constructor Summary
public  GenericKeyedObjectPool()
     Create a new GenericKeyedObjectPool..
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, GenericKeyedObjectPool.Config config)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
     Create a new GenericKeyedObjectPool using the specified values.
public  GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
     Create a new GenericKeyedObjectPool using the specified values.

Method Summary
public synchronized  voidaddObject(Object key)
    
public synchronized  ObjectborrowObject(Object key)
    
public synchronized  voidclear()
    
public synchronized  voidclear(Object key)
    
public synchronized  voidclearOldest()
     Method clears oldest 15% of objects in pool.
public synchronized  voidclose()
    
synchronized  StringdebugInfo()
    
public synchronized  voidevict()
    
public synchronized  intgetMaxActive()
     Returns the cap on the number of active instances from my pool (per key).
public synchronized  intgetMaxIdle()
     Returns the cap on the number of "idle" instances in the pool.
public synchronized  intgetMaxTotal()
     Returns the cap on the total number of instances from my pool if non-positive.
public synchronized  longgetMaxWait()
     Returns the maximum amount of time (in milliseconds) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.setWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK .
public synchronized  longgetMinEvictableIdleTimeMillis()
     Returns the minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
public synchronized  intgetMinIdle()
    
public synchronized  intgetNumActive()
    
public synchronized  intgetNumActive(Object key)
    
public synchronized  intgetNumIdle()
    
public synchronized  intgetNumIdle(Object key)
    
public synchronized  intgetNumTestsPerEvictionRun()
     Returns the number of objects to examine during each run of the idle object evictor thread (if any).
public synchronized  booleangetTestOnBorrow()
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned by the GenericKeyedObjectPool.borrowObject method.
public synchronized  booleangetTestOnReturn()
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericKeyedObjectPool.returnObject .
public synchronized  booleangetTestWhileIdle()
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated by the idle object evictor (if any).
public synchronized  longgetTimeBetweenEvictionRunsMillis()
     Returns the number of milliseconds to sleep between runs of the idle object evictor thread.
public synchronized  bytegetWhenExhaustedAction()
     Returns the action to take when the GenericKeyedObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
public synchronized  voidinvalidateObject(Object key, Object obj)
    
public synchronized  voidpreparePool(Object key, boolean populateImmediately)
     Registers a key for pool control. If populateImmediately is true, the pool will immediately commence a sustain cycle.
public synchronized  voidreturnObject(Object key, Object obj)
    
public synchronized  voidsetConfig(GenericKeyedObjectPool.Config conf)
     Sets my configuration.
public synchronized  voidsetFactory(KeyedPoolableObjectFactory factory)
    
public synchronized  voidsetMaxActive(int maxActive)
     Sets the cap on the number of active instances from my pool (per key).
public synchronized  voidsetMaxIdle(int maxIdle)
     Sets the cap on the number of "idle" instances in the pool.
public synchronized  voidsetMaxTotal(int maxTotal)
     Sets the cap on the total number of instances from my pool if non-positive.
public synchronized  voidsetMaxWait(long maxWait)
     Sets the maximum amount of time (in milliseconds) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.setWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK .
public synchronized  voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
     Sets the minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
public synchronized  voidsetMinIdle(int poolSize)
    
public synchronized  voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
     Sets the number of objects to examine during each run of the idle object evictor thread (if any).

When a negative value is supplied, ceil( GenericKeyedObjectPool.getNumIdle )/abs( GenericKeyedObjectPool.getNumTestsPerEvictionRun ) tests will be run.

public synchronized  voidsetTestOnBorrow(boolean testOnBorrow)
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned by the GenericKeyedObjectPool.borrowObject method.
public synchronized  voidsetTestOnReturn(boolean testOnReturn)
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericKeyedObjectPool.returnObject .
public synchronized  voidsetTestWhileIdle(boolean testWhileIdle)
     When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated by the idle object evictor (if any).
public synchronized  voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
     Sets the number of milliseconds to sleep between runs of the idle object evictor thread.
public synchronized  voidsetWhenExhaustedAction(byte whenExhaustedAction)
     Sets the action to take when the GenericKeyedObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
protected synchronized  voidstartEvictor(long delay)
     Start the eviction thread or service, or when delay is non-positive, stop it if it is already running.

Field Detail
DEFAULT_MAX_ACTIVE
final public static int DEFAULT_MAX_ACTIVE(Code)
The default cap on the total number of active instances from the pool (per key).
See Also:   GenericKeyedObjectPool.getMaxActive
See Also:   GenericKeyedObjectPool.setMaxActive



DEFAULT_MAX_IDLE
final public static int DEFAULT_MAX_IDLE(Code)
The default cap on the number of idle instances in the pool (per key).
See Also:   GenericKeyedObjectPool.getMaxIdle
See Also:   GenericKeyedObjectPool.setMaxIdle



DEFAULT_MAX_TOTAL
final public static int DEFAULT_MAX_TOTAL(Code)
The default cap on the the maximum number of objects that can exists at one time.
See Also:   GenericKeyedObjectPool.getMaxTotal
See Also:   GenericKeyedObjectPool.setMaxTotal



DEFAULT_MAX_WAIT
final public static long DEFAULT_MAX_WAIT(Code)
The default maximum amount of time (in millis) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.getWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK .
See Also:   GenericKeyedObjectPool.getMaxWait
See Also:   GenericKeyedObjectPool.setMaxWait



DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
final public static long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS(Code)
The default value for GenericKeyedObjectPool.getMinEvictableIdleTimeMillis .
See Also:   GenericKeyedObjectPool.getMinEvictableIdleTimeMillis
See Also:   GenericKeyedObjectPool.setMinEvictableIdleTimeMillis



DEFAULT_MIN_IDLE
final public static int DEFAULT_MIN_IDLE(Code)
The default minimum level of idle objects in the pool.
See Also:   GenericKeyedObjectPool.setMinIdle
See Also:   GenericKeyedObjectPool.getMinIdle



DEFAULT_NUM_TESTS_PER_EVICTION_RUN
final public static int DEFAULT_NUM_TESTS_PER_EVICTION_RUN(Code)
The default number of objects to examine per run in the idle object evictor.
See Also:   GenericKeyedObjectPool.getNumTestsPerEvictionRun
See Also:   GenericKeyedObjectPool.setNumTestsPerEvictionRun
See Also:   GenericKeyedObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



DEFAULT_TEST_ON_BORROW
final public static boolean DEFAULT_TEST_ON_BORROW(Code)
The default "test on borrow" value.
See Also:   GenericKeyedObjectPool.getTestOnBorrow
See Also:   GenericKeyedObjectPool.setTestOnBorrow



DEFAULT_TEST_ON_RETURN
final public static boolean DEFAULT_TEST_ON_RETURN(Code)
The default "test on return" value.
See Also:   GenericKeyedObjectPool.getTestOnReturn
See Also:   GenericKeyedObjectPool.setTestOnReturn



DEFAULT_TEST_WHILE_IDLE
final public static boolean DEFAULT_TEST_WHILE_IDLE(Code)
The default "test while idle" value.
See Also:   GenericKeyedObjectPool.getTestWhileIdle
See Also:   GenericKeyedObjectPool.setTestWhileIdle
See Also:   GenericKeyedObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
final public static long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS(Code)
The default "time between eviction runs" value.
See Also:   GenericKeyedObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



DEFAULT_WHEN_EXHAUSTED_ACTION
final public static byte DEFAULT_WHEN_EXHAUSTED_ACTION(Code)
The default "when exhausted action" for the pool.
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction



WHEN_EXHAUSTED_BLOCK
final public static byte WHEN_EXHAUSTED_BLOCK(Code)
A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should block until a new object is available, or the GenericKeyedObjectPool.getMaxWait maximum wait time has been reached.
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.setMaxWait
See Also:   GenericKeyedObjectPool.getMaxWait
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction



WHEN_EXHAUSTED_FAIL
final public static byte WHEN_EXHAUSTED_FAIL(Code)
A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should fail, throwing a NoSuchElementException .
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction



WHEN_EXHAUSTED_GROW
final public static byte WHEN_EXHAUSTED_GROW(Code)
A "when exhausted action" type indicating that when the pool is exhausted (i.e., the maximum number of active objects has been reached), the GenericKeyedObjectPool.borrowObject method should simply create a new object anyway.
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction




Constructor Detail
GenericKeyedObjectPool
public GenericKeyedObjectPool()(Code)
Create a new GenericKeyedObjectPool..



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, GenericKeyedObjectPool.Config config)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  config - a non-null GenericKeyedObjectPool.Config describing my configuration



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericKeyedObjectPool.borrowObject method (see GenericKeyedObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericKeyedObjectPool.returnObject method (see GenericKeyedObjectPool.setTestOnReturn)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (per key) (see GenericKeyedObjectPool.setMaxIdle)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)KeyedPoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.getMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericKeyedObjectPool.setMaxIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericKeyedObjectPool.borrowObject method (see GenericKeyedObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericKeyedObjectPool.returnObject method (see GenericKeyedObjectPool.setTestOnReturn)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericKeyedObjectPool.setMaxIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericKeyedObjectPool.borrowObject method (see GenericKeyedObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericKeyedObjectPool.returnObject method (see GenericKeyedObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericKeyedObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericKeyedObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericKeyedObjectPool.setTestWhileIdle)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericKeyedObjectPool.setMaxIdle)
Parameters:
  maxTotal - the maximum number of objects that can exists at one time (see GenericKeyedObjectPool.setMaxTotal)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericKeyedObjectPool.borrowObject method (see GenericKeyedObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericKeyedObjectPool.returnObject method (see GenericKeyedObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericKeyedObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericKeyedObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericKeyedObjectPool.setTestWhileIdle)



GenericKeyedObjectPool
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code)
Create a new GenericKeyedObjectPool using the specified values.
Parameters:
  factory - the (possibly null)PoolableObjectFactory to use to create, validate and destroy objects
Parameters:
  maxActive - the maximum number of objects that can be borrowed from me at one time (per key) (see GenericKeyedObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericKeyedObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericKeyedObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericKeyedObjectPool.setMaxIdle)
Parameters:
  maxTotal - the maximum number of objects that can exists at one time (see GenericKeyedObjectPool.setMaxTotal)
Parameters:
  minIdle - the minimum number of idle objects to have in the pool at any one time (see GenericKeyedObjectPool.setMinIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericKeyedObjectPool.borrowObject method (see GenericKeyedObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericKeyedObjectPool.returnObject method (see GenericKeyedObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericKeyedObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericKeyedObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericKeyedObjectPool.setTestWhileIdle)




Method Detail
addObject
public synchronized void addObject(Object key) throws Exception(Code)



borrowObject
public synchronized Object borrowObject(Object key) throws Exception(Code)



clear
public synchronized void clear()(Code)



clear
public synchronized void clear(Object key)(Code)



clearOldest
public synchronized void clearOldest()(Code)
Method clears oldest 15% of objects in pool. The method sorts the objects into a TreeMap and then iterates the first 15% for removal



close
public synchronized void close() throws Exception(Code)



debugInfo
synchronized String debugInfo()(Code)



evict
public synchronized void evict() throws Exception(Code)



getMaxActive
public synchronized int getMaxActive()(Code)
Returns the cap on the number of active instances from my pool (per key). the cap on the number of active instances from my pool (per key).
See Also:   GenericKeyedObjectPool.setMaxActive



getMaxIdle
public synchronized int getMaxIdle()(Code)
Returns the cap on the number of "idle" instances in the pool. the cap on the number of "idle" instances in the pool.
See Also:   GenericKeyedObjectPool.setMaxIdle



getMaxTotal
public synchronized int getMaxTotal()(Code)
Returns the cap on the total number of instances from my pool if non-positive. the cap on the total number of instances from my pool if non-positive.
See Also:   GenericKeyedObjectPool.setMaxTotal



getMaxWait
public synchronized long getMaxWait()(Code)
Returns the maximum amount of time (in milliseconds) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.setWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK . When less than 0, the GenericKeyedObjectPool.borrowObject method may block indefinitely.
See Also:   GenericKeyedObjectPool.setMaxWait
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK



getMinEvictableIdleTimeMillis
public synchronized long getMinEvictableIdleTimeMillis()(Code)
Returns the minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
See Also:   GenericKeyedObjectPool.setMinEvictableIdleTimeMillis
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



getMinIdle
public synchronized int getMinIdle()(Code)
Returns the minimum number of idle objects in pool to maintain (per key) the minimum number of idle objects in pool to maintain (per key)
See Also:   GenericKeyedObjectPool.setMinIdle



getNumActive
public synchronized int getNumActive()(Code)



getNumActive
public synchronized int getNumActive(Object key)(Code)



getNumIdle
public synchronized int getNumIdle()(Code)



getNumIdle
public synchronized int getNumIdle(Object key)(Code)



getNumTestsPerEvictionRun
public synchronized int getNumTestsPerEvictionRun()(Code)
Returns the number of objects to examine during each run of the idle object evictor thread (if any).
See Also:   GenericKeyedObjectPool.setNumTestsPerEvictionRun
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



getTestOnBorrow
public synchronized boolean getTestOnBorrow()(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned by the GenericKeyedObjectPool.borrowObject method. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.
See Also:   GenericKeyedObjectPool.setTestOnBorrow



getTestOnReturn
public synchronized boolean getTestOnReturn()(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericKeyedObjectPool.returnObject .
See Also:   GenericKeyedObjectPool.setTestOnReturn



getTestWhileIdle
public synchronized boolean getTestWhileIdle()(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.
See Also:   GenericKeyedObjectPool.setTestWhileIdle
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



getTimeBetweenEvictionRunsMillis
public synchronized long getTimeBetweenEvictionRunsMillis()(Code)
Returns the number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



getWhenExhaustedAction
public synchronized byte getWhenExhaustedAction()(Code)
Returns the action to take when the GenericKeyedObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached). one of GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL or GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction



invalidateObject
public synchronized void invalidateObject(Object key, Object obj) throws Exception(Code)



preparePool
public synchronized void preparePool(Object key, boolean populateImmediately)(Code)
Registers a key for pool control. If populateImmediately is true, the pool will immediately commence a sustain cycle. If populateImmediately is false, the pool will be populated when the next schedules sustain task is run.
Parameters:
  key - - The key to register for pool control.
Parameters:
  populateImmediately - - If this is true, the poolwill start a sustain cycle immediately.



returnObject
public synchronized void returnObject(Object key, Object obj) throws Exception(Code)



setConfig
public synchronized void setConfig(GenericKeyedObjectPool.Config conf)(Code)
Sets my configuration.
See Also:   GenericKeyedObjectPool.Config



setFactory
public synchronized void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException(Code)



setMaxActive
public synchronized void setMaxActive(int maxActive)(Code)
Sets the cap on the number of active instances from my pool (per key).
Parameters:
  maxActive - The cap on the number of active instances from my pool (per key).Use a negative value for an infinite number of instances.
See Also:   GenericKeyedObjectPool.getMaxActive



setMaxIdle
public synchronized void setMaxIdle(int maxIdle)(Code)
Sets the cap on the number of "idle" instances in the pool.
Parameters:
  maxIdle - The cap on the number of "idle" instances in the pool.Use a negative value to indicate an unlimited numberof idle instances.
See Also:   GenericKeyedObjectPool.getMaxIdle



setMaxTotal
public synchronized void setMaxTotal(int maxTotal)(Code)
Sets the cap on the total number of instances from my pool if non-positive.
Parameters:
  maxTotal - The cap on the total number of instances from my pool.Use a non-positive value for an infinite number of instances.
See Also:   GenericKeyedObjectPool.getMaxTotal



setMaxWait
public synchronized void setMaxWait(long maxWait)(Code)
Sets the maximum amount of time (in milliseconds) the GenericKeyedObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericKeyedObjectPool.setWhenExhaustedAction "when exhausted" action is GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK . When less than 0, the GenericKeyedObjectPool.borrowObject method may block indefinitely.
See Also:   GenericKeyedObjectPool.getMaxWait
See Also:   GenericKeyedObjectPool.setWhenExhaustedAction
See Also:   GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK



setMinEvictableIdleTimeMillis
public synchronized void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)(Code)
Sets the minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). When non-positive, no objects will be evicted from the pool due to idle time alone.
See Also:   GenericKeyedObjectPool.getMinEvictableIdleTimeMillis
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



setMinIdle
public synchronized void setMinIdle(int poolSize)(Code)
Sets the minimum number of idle objects in pool to maintain (per key)
Parameters:
  poolSize - - The minimum size of the pool
See Also:   GenericKeyedObjectPool.getMinIdle



setNumTestsPerEvictionRun
public synchronized void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)(Code)
Sets the number of objects to examine during each run of the idle object evictor thread (if any).

When a negative value is supplied, ceil( GenericKeyedObjectPool.getNumIdle )/abs( GenericKeyedObjectPool.getNumTestsPerEvictionRun ) tests will be run. I.e., when the value is -n, roughly one nth of the idle objects will be tested per run.
See Also:   GenericKeyedObjectPool.getNumTestsPerEvictionRun
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis




setTestOnBorrow
public synchronized void setTestOnBorrow(boolean testOnBorrow)(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned by the GenericKeyedObjectPool.borrowObject method. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.
See Also:   GenericKeyedObjectPool.getTestOnBorrow



setTestOnReturn
public synchronized void setTestOnReturn(boolean testOnReturn)(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericKeyedObjectPool.returnObject .
See Also:   GenericKeyedObjectPool.getTestOnReturn



setTestWhileIdle
public synchronized void setTestWhileIdle(boolean testWhileIdle)(Code)
When true, objects will be org.apache.commons.pool.PoolableObjectFactory.validateObject validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.
See Also:   GenericKeyedObjectPool.getTestWhileIdle
See Also:   GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis



setTimeBetweenEvictionRunsMillis
public synchronized void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)(Code)
Sets the number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.
See Also:   GenericKeyedObjectPool.getTimeBetweenEvictionRunsMillis



setWhenExhaustedAction
public synchronized void setWhenExhaustedAction(byte whenExhaustedAction)(Code)
Sets the action to take when the GenericKeyedObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
Parameters:
  whenExhaustedAction - the action code, which must be one ofGenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL,or GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericKeyedObjectPool.getWhenExhaustedAction



startEvictor
protected synchronized void startEvictor(long delay)(Code)
Start the eviction thread or service, or when delay is non-positive, stop it if it is already running.



Methods inherited from org.apache.commons.pool.BaseKeyedObjectPool
public void addObject(Object key) throws Exception, UnsupportedOperationException(Code)(Java Doc)
abstract public Object borrowObject(Object key) throws Exception(Code)(Java Doc)
public void clear() throws Exception, UnsupportedOperationException(Code)(Java Doc)
public void clear(Object key) throws Exception, UnsupportedOperationException(Code)(Java Doc)
public void close() throws Exception(Code)(Java Doc)
public int getNumActive(Object key) throws UnsupportedOperationException(Code)(Java Doc)
public int getNumActive() throws UnsupportedOperationException(Code)(Java Doc)
public int getNumIdle(Object key) throws UnsupportedOperationException(Code)(Java Doc)
public int getNumIdle() throws UnsupportedOperationException(Code)(Java Doc)
abstract public void invalidateObject(Object key, Object obj) throws Exception(Code)(Java Doc)
abstract public void returnObject(Object key, Object obj) throws Exception(Code)(Java Doc)
public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException, UnsupportedOperationException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.