Java Doc for GenericObjectPool.java in  » Web-Crawler » heritrix » 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 » Web Crawler » heritrix » org.apache.commons.pool.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.pool.impl.GenericObjectPool

All known Subclasses:   org.apache.commons.pool.impl.FairGenericObjectPool,
GenericObjectPool
public class GenericObjectPool extends BaseObjectPool implements ObjectPool(Code)
A configurable ObjectPool implementation.

When coupled with the appropriate PoolableObjectFactory , GenericObjectPool provides robust pooling functionality for arbitrary objects.

A GenericObjectPool 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:

  • GenericObjectPool.setTimeBetweenEvictionRunsMillis timeBetweenEvictionRunsMillis indicates how long the eviction thread should sleep before "runs" of examining idle objects. When non-positive, no eviction thread will be launched.
  • GenericObjectPool.setMinEvictableIdleTimeMillis minEvictableIdleTimeMillis specifies the minimum amount of time that an object may sit idle in the pool before it is eligable for eviction due to idle time. When non-positive, no object will be dropped from the pool due to idle time alone.
  • GenericObjectPool.setTestWhileIdle testWhileIdle indicates whether or not idle objects should be validated using the factory's PoolableObjectFactory.validateObject method. Objects that fail to validate will be dropped from the pool.

GenericObjectPool is not usable without a PoolableObjectFactory . A non-null factory must be provided either as a constructor argument or via a call to GenericObjectPool.setFactory before the pool is used.
See Also:   GenericKeyedObjectPool
author:
   Rodney Waldhoff
author:
   Dirk Verbeeck
version:
   $Revision: 4672 $ $Date: 2006-09-27 00:03:16 +0000 (Wed, 27 Sep 2006) $


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.
final public static  intDEFAULT_MAX_IDLE
     The default cap on the number of "sleeping" instances in the pool.
final public static  longDEFAULT_MAX_WAIT
     The default maximum amount of time (in millis) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.getWhenExhaustedAction "when exhausted" action is GenericObjectPool.WHEN_EXHAUSTED_BLOCK .
final public static  longDEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS
     The default value for GenericObjectPool.getMinEvictableIdleTimeMillis .
final public static  intDEFAULT_MIN_IDLE
     The default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects.
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  longDEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
     The default value for GenericObjectPool.getSoftMinEvictableIdleTimeMillis .
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 static  TimerEVICTION_TIMER
     Idle object evition Timer.
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 GenericObjectPool.borrowObject method should block until a new object is available, or the GenericObjectPool.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 GenericObjectPool.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 GenericObjectPool.borrowObject method should simply create a new object anyway.
protected  PoolableObjectFactory_factory
     My PoolableObjectFactory .
protected  int_maxActive
     The cap on the total number of active instances from the pool.
protected  long_maxWait
     The maximum amount of time (in millis) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.getWhenExhaustedAction "when exhausted" action is GenericObjectPool.WHEN_EXHAUSTED_BLOCK .
protected  int_numActive
     The number of objects GenericObjectPool.borrowObject borrowed from the pool, but not yet returned.
protected  LinkedList_pool
     My pool.
protected  boolean_testOnBorrow
     When true, objects will be PoolableObjectFactory.validateObject validated before being returned by the GenericObjectPool.borrowObject method.
protected  byte_whenExhaustedAction
     The action to take when the GenericObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).

Constructor Summary
public  GenericObjectPool()
     Create a new GenericObjectPool.
public  GenericObjectPool(PoolableObjectFactory factory)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, GenericObjectPool.Config config)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
     Create a new GenericObjectPool using the specified values.
public  GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis)
     Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle)
Parameters:
  minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle)
Parameters:
  softMinEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition with the extra condition that at least "minIdle" amount of object remain in the pool.

Method Summary
public synchronized  voidaddObject()
     Create an object, and place it into the pool.
public synchronized  ObjectborrowObject()
    
public synchronized  voidclear()
    
public synchronized  voidclose()
    
synchronized  StringdebugInfo()
    
public synchronized  voidevict()
    
public synchronized  intgetMaxActive()
     Returns the cap on the total number of active instances from my pool.
public synchronized  intgetMaxIdle()
     Returns the cap on the number of "idle" instances in the pool.
public synchronized  longgetMaxWait()
     Returns the maximum amount of time (in milliseconds) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.setWhenExhaustedAction "when exhausted" action is GenericObjectPool.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()
     Returns the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects.
public synchronized  intgetNumActive()
    
public synchronized  intgetNumIdle()
    
public synchronized  intgetNumTestsPerEvictionRun()
     Returns the max number of objects to examine during each run of the idle object evictor thread (if any).
public synchronized  longgetSoftMinEvictableIdleTimeMillis()
     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), with the extra condition that at least "minIdle" amount of object remain in the pool.
public synchronized  booleangetTestOnBorrow()
     When true, objects will be PoolableObjectFactory.validateObject validated before being returned by the GenericObjectPool.borrowObject method.
public synchronized  booleangetTestOnReturn()
     When true, objects will be PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericObjectPool.returnObject .
public synchronized  booleangetTestWhileIdle()
     When true, objects will be 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 GenericObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
public synchronized  voidinvalidateObject(Object obj)
    
public synchronized  voidreturnObject(Object obj)
    
public synchronized  voidsetConfig(GenericObjectPool.Config conf)
     Sets my configuration.
public synchronized  voidsetFactory(PoolableObjectFactory factory)
    
public synchronized  voidsetMaxActive(int maxActive)
     Sets the cap on the total number of active instances from my pool.
public synchronized  voidsetMaxIdle(int maxIdle)
     Sets the cap on the number of "idle" instances in the pool.
public synchronized  voidsetMaxWait(long maxWait)
     Sets the maximum amount of time (in milliseconds) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.setWhenExhaustedAction "when exhausted" action is GenericObjectPool.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 minIdle)
     Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects.
public synchronized  voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
     Sets the max number of objects to examine during each run of the idle object evictor thread (if any).

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

public synchronized  voidsetSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)
     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), with the extra condition that at least "minIdle" amount of object remain in the pool.
public synchronized  voidsetTestOnBorrow(boolean testOnBorrow)
     When true, objects will be PoolableObjectFactory.validateObject validated before being returned by the GenericObjectPool.borrowObject method.
public synchronized  voidsetTestOnReturn(boolean testOnReturn)
     When true, objects will be PoolableObjectFactory.validateObject validated before being returned to the pool within the GenericObjectPool.returnObject .
public synchronized  voidsetTestWhileIdle(boolean testWhileIdle)
     When true, objects will be 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 GenericObjectPool.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.
See Also:   GenericObjectPool.getMaxActive



DEFAULT_MAX_IDLE
final public static int DEFAULT_MAX_IDLE(Code)
The default cap on the number of "sleeping" instances in the pool.
See Also:   GenericObjectPool.getMaxIdle
See Also:   GenericObjectPool.setMaxIdle



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



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



DEFAULT_MIN_IDLE
final public static int DEFAULT_MIN_IDLE(Code)
The default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects.
See Also:   GenericObjectPool.getMinIdle
See Also:   GenericObjectPool.setMinIdle



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:   GenericObjectPool.getNumTestsPerEvictionRun
See Also:   GenericObjectPool.setNumTestsPerEvictionRun
See Also:   GenericObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericObjectPool.setTimeBetweenEvictionRunsMillis



DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS
final public static long DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS(Code)
The default value for GenericObjectPool.getSoftMinEvictableIdleTimeMillis .
See Also:   GenericObjectPool.getSoftMinEvictableIdleTimeMillis
See Also:   GenericObjectPool.setSoftMinEvictableIdleTimeMillis



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



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



DEFAULT_TEST_WHILE_IDLE
final public static boolean DEFAULT_TEST_WHILE_IDLE(Code)
The default "test while idle" value.
See Also:   GenericObjectPool.getTestWhileIdle
See Also:   GenericObjectPool.setTestWhileIdle
See Also:   GenericObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericObjectPool.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:   GenericObjectPool.getTimeBetweenEvictionRunsMillis
See Also:   GenericObjectPool.setTimeBetweenEvictionRunsMillis



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



EVICTION_TIMER
final static Timer EVICTION_TIMER(Code)
Idle object evition Timer. Shared between all GenericObjectPool s and GenericKeyedObjectPool s.



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 GenericObjectPool.borrowObject method should block until a new object is available, or the GenericObjectPool.getMaxWait maximum wait time has been reached.
See Also:   GenericObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericObjectPool.setMaxWait
See Also:   GenericObjectPool.getMaxWait
See Also:   GenericObjectPool.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 GenericObjectPool.borrowObject method should fail, throwing a NoSuchElementException .
See Also:   GenericObjectPool.WHEN_EXHAUSTED_BLOCK
See Also:   GenericObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericObjectPool.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 GenericObjectPool.borrowObject method should simply create a new object anyway.
See Also:   GenericObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericObjectPool.setWhenExhaustedAction



_factory
protected PoolableObjectFactory _factory(Code)
My PoolableObjectFactory .



_maxActive
protected int _maxActive(Code)
The cap on the total number of active instances from the pool.
See Also:   GenericObjectPool.setMaxActive
See Also:   GenericObjectPool.getMaxActive



_maxWait
protected long _maxWait(Code)
The maximum amount of time (in millis) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.getWhenExhaustedAction "when exhausted" action is GenericObjectPool.WHEN_EXHAUSTED_BLOCK . When less than 0, the GenericObjectPool.borrowObject method may block indefinitely.
See Also:   GenericObjectPool.setMaxWait
See Also:   GenericObjectPool.getMaxWait
See Also:   GenericObjectPool.WHEN_EXHAUSTED_BLOCK
See Also:   GenericObjectPool.setWhenExhaustedAction
See Also:   GenericObjectPool.getWhenExhaustedAction



_numActive
protected int _numActive(Code)
The number of objects GenericObjectPool.borrowObject borrowed from the pool, but not yet returned.



_pool
protected LinkedList _pool(Code)
My pool.



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



_whenExhaustedAction
protected byte _whenExhaustedAction(Code)
The action to take when the GenericObjectPool.borrowObject method is invoked when the pool is exhausted (the maximum number of "active" objects has been reached).
See Also:   GenericObjectPool.WHEN_EXHAUSTED_BLOCK
See Also:   GenericObjectPool.WHEN_EXHAUSTED_FAIL
See Also:   GenericObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION
See Also:   GenericObjectPool.setWhenExhaustedAction
See Also:   GenericObjectPool.getWhenExhaustedAction




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



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



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



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.getTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.getTestOnReturn)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.getMaxIdle)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.getWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.getMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.getMaxIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.getTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.getTestOnReturn)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory 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 GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle)
Parameters:
  minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle)



GenericObjectPool
public GenericObjectPool(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis)(Code)
Create a new GenericObjectPool 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 (see GenericObjectPool.setMaxActive)
Parameters:
  whenExhaustedAction - the action to take when the pool is exhausted (see GenericObjectPool.setWhenExhaustedAction)
Parameters:
  maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted an and whenExhaustedAction is GenericObjectPool.WHEN_EXHAUSTED_BLOCK (otherwise ignored) (see GenericObjectPool.setMaxWait)
Parameters:
  maxIdle - the maximum number of idle objects in my pool (see GenericObjectPool.setMaxIdle)
Parameters:
  minIdle - the minimum number of idle objects in my pool (see GenericObjectPool.setMinIdle)
Parameters:
  testOnBorrow - whether or not to validate objects before they are returned by the GenericObjectPool.borrowObject method (see GenericObjectPool.setTestOnBorrow)
Parameters:
  testOnReturn - whether or not to validate objects after they are returned to the GenericObjectPool.returnObject method (see GenericObjectPool.setTestOnReturn)
Parameters:
  timeBetweenEvictionRunsMillis - the amount of time (in milliseconds) to sleep between examining idle objects for eviction (see GenericObjectPool.setTimeBetweenEvictionRunsMillis)
Parameters:
  numTestsPerEvictionRun - the number of idle objects to examine per run within the idle object eviction thread (if any) (see GenericObjectPool.setNumTestsPerEvictionRun)
Parameters:
  minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition (see GenericObjectPool.setMinEvictableIdleTimeMillis)
Parameters:
  testWhileIdle - whether or not to validate objects in the idle object eviction thread, if any (see GenericObjectPool.setTestWhileIdle)
Parameters:
  softMinEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligable for evcition with the extra condition that at least "minIdle" amount of object remain in the pool. (see GenericObjectPool.setSoftMinEvictableIdleTimeMillis)




Method Detail
addObject
public synchronized void addObject() throws Exception(Code)
Create an object, and place it into the pool. addObject() is useful for "pre-loading" a pool with idle objects.



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



clear
public synchronized void clear()(Code)



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 total number of active instances from my pool. the cap on the total number of active instances from my pool.
See Also:   GenericObjectPool.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:   GenericObjectPool.setMaxIdle



getMaxWait
public synchronized long getMaxWait()(Code)
Returns the maximum amount of time (in milliseconds) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.setWhenExhaustedAction "when exhausted" action is GenericObjectPool.WHEN_EXHAUSTED_BLOCK . When less than 0, the GenericObjectPool.borrowObject method may block indefinitely.
See Also:   GenericObjectPool.setMaxWait
See Also:   GenericObjectPool.setWhenExhaustedAction
See Also:   GenericObjectPool.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:   GenericObjectPool.setMinEvictableIdleTimeMillis
See Also:   GenericObjectPool.setTimeBetweenEvictionRunsMillis



getMinIdle
public synchronized int getMinIdle()(Code)
Returns the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects. (Note no objects are created when: numActive + numIdle >= maxActive) The minimum number of objects.
See Also:   GenericObjectPool.setMinIdle



getNumActive
public synchronized int getNumActive()(Code)



getNumIdle
public synchronized int getNumIdle()(Code)



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



getSoftMinEvictableIdleTimeMillis
public synchronized long getSoftMinEvictableIdleTimeMillis()(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), with the extra condition that at least "minIdle" amount of object remain in the pool.
See Also:   GenericObjectPool.setSoftMinEvictableIdleTimeMillis



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



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



getTestWhileIdle
public synchronized boolean getTestWhileIdle()(Code)
When true, objects will be 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:   GenericObjectPool.setTestWhileIdle
See Also:   GenericObjectPool.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:   GenericObjectPool.setTimeBetweenEvictionRunsMillis



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



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



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



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



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



setMaxActive
public synchronized void setMaxActive(int maxActive)(Code)
Sets the cap on the total number of active instances from my pool.
Parameters:
  maxActive - The cap on the total number of active instances from my pool.Use a negative value for an infinite number of instances.
See Also:   GenericObjectPool.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:   GenericObjectPool.getMaxIdle



setMaxWait
public synchronized void setMaxWait(long maxWait)(Code)
Sets the maximum amount of time (in milliseconds) the GenericObjectPool.borrowObject method should block before throwing an exception when the pool is exhausted and the GenericObjectPool.setWhenExhaustedAction "when exhausted" action is GenericObjectPool.WHEN_EXHAUSTED_BLOCK . When less than 0, the GenericObjectPool.borrowObject method may block indefinitely.
See Also:   GenericObjectPool.getMaxWait
See Also:   GenericObjectPool.setWhenExhaustedAction
See Also:   GenericObjectPool.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:   GenericObjectPool.getMinEvictableIdleTimeMillis
See Also:   GenericObjectPool.setTimeBetweenEvictionRunsMillis



setMinIdle
public synchronized void setMinIdle(int minIdle)(Code)
Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects. (Note no objects are created when: numActive + numIdle >= maxActive)
Parameters:
  minIdle - The minimum number of objects.
See Also:   GenericObjectPool.getMinIdle



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

When a negative value is supplied, ceil( GenericObjectPool.getNumIdle )/abs( GenericObjectPool.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:   GenericObjectPool.getNumTestsPerEvictionRun
See Also:   GenericObjectPool.setTimeBetweenEvictionRunsMillis




setSoftMinEvictableIdleTimeMillis
public synchronized void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)(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), with the extra condition that at least "minIdle" amount of object remain in the pool. When non-positive, no objects will be evicted from the pool due to idle time alone.
See Also:   GenericObjectPool.getSoftMinEvictableIdleTimeMillis



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



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



setTestWhileIdle
public synchronized void setTestWhileIdle(boolean testWhileIdle)(Code)
When true, objects will be 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:   GenericObjectPool.getTestWhileIdle
See Also:   GenericObjectPool.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:   GenericObjectPool.getTimeBetweenEvictionRunsMillis



setWhenExhaustedAction
public synchronized void setWhenExhaustedAction(byte whenExhaustedAction)(Code)
Sets the action to take when the GenericObjectPool.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 ofGenericObjectPool.WHEN_EXHAUSTED_BLOCK, GenericObjectPool.WHEN_EXHAUSTED_FAIL,or GenericObjectPool.WHEN_EXHAUSTED_GROW
See Also:   GenericObjectPool.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.



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