public abstract class ConnectionPool
extends java.lang.Object
implements java.io.Serializable
ConnectionPool objects generate the following events:
ConnectionPoolEvent - The events fired are:
| Constructor and Description |
|---|
ConnectionPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionPoolListener(ConnectionPoolListener listener)
Adds a ConnectionPoolListener.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.
|
abstract void |
close()
Closes the connection pool.
|
protected void |
finalize()
Closes the connection pool if not explicitly closed by the caller.
|
long |
getCleanupInterval()
Returns the time interval for how often the maintenance daemon is run.
|
int |
getMaxConnections()
Returns the maximum number of connections.
|
long |
getMaxInactivity()
Returns the maximum amount of inactive time before an available connection is closed.
|
long |
getMaxLifetime()
Returns the maximum life for an available connection.
|
int |
getMaxUseCount()
Returns the maximum number of times a connection can be used before it is replaced in the pool.
|
long |
getMaxUseTime()
Returns the maximum amount of time a connection can be in use before it is closed and returned to the pool.
|
boolean |
isPretestConnections()
Indicates whether connections are pretested before they are allocated to requesters.
|
boolean |
isRunMaintenance()
Indicates whether the maintenance thread is used to cleanup expired connections.
|
boolean |
isThreadUsed()
Indicates whether threads are used in communication with the host servers and for running
maintenance.
|
void |
removeConnectionPoolListener(ConnectionPoolListener listener)
Removes a ConnectionPoolListener.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.
|
void |
setCleanupInterval(long cleanupInterval)
Sets the time interval for how often the maintenance daemon is run.
|
void |
setMaxConnections(int maxConnections)
Sets the maximum number of connections.
|
void |
setMaxInactivity(long maxInactivity)
Sets the maximum amount of inactive time before an available connection is closed.
|
void |
setMaxLifetime(long maxLifetime)
Sets the maximum life for an available connection.
|
void |
setMaxUseCount(int maxUseCount)
Sets the maximum number of times a connection can be used before it is replaced in the pool.
|
void |
setMaxUseTime(long maxUseTime)
Sets the maximum amount of time a connection can be in use before it is closed and returned to the pool.
|
void |
setPretestConnections(boolean pretest)
Sets whether connections are pretested before they are allocated to requesters.
|
void |
setRunMaintenance(boolean cleanup)
Sets whether the Toolbox does periodic maintenance on the connection pool to clean up
expired connections.
|
void |
setThreadUsed(boolean useThreads)
Sets whether the IBM Toolbox for Java uses additional threads.
|
public void addConnectionPoolListener(ConnectionPoolListener listener)
listener - The ConnectionPoolListener.removeConnectionPoolListener(com.ibm.as400.access.ConnectionPoolListener)public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The PropertyChangeListener.removePropertyChangeListener(java.beans.PropertyChangeListener)public abstract void close()
throws ConnectionPoolException
ConnectionPoolException - If a pool error occurs.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - If an error occurs.public long getCleanupInterval()
public int getMaxConnections()
public long getMaxInactivity()
public long getMaxLifetime()
public int getMaxUseCount()
public long getMaxUseTime()
public boolean isPretestConnections()
Note: The pretestConnections property is not fully effective until IBM i 7.1.
AS400.isConnectionAlive()public boolean isRunMaintenance()
public boolean isThreadUsed()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The PropertyChangeListener.addPropertyChangeListener(java.beans.PropertyChangeListener)public void removeConnectionPoolListener(ConnectionPoolListener listener)
listener - The ConnectionPoolListener.addConnectionPoolListener(com.ibm.as400.access.ConnectionPoolListener)public void setCleanupInterval(long cleanupInterval)
cleanupInterval - The number of milliseconds.public void setMaxConnections(int maxConnections)
maxConnections - Maximum number of connections.public void setMaxInactivity(long maxInactivity)
maxInactivity - Number of milliseconds.public void setMaxLifetime(long maxLifetime)
maxLifetime - Number of milliseconds.public void setMaxUseCount(int maxUseCount)
maxUseCount - Maximum usage count.public void setMaxUseTime(long maxUseTime)
maxUseTime - Number of milliseconds.public void setPretestConnections(boolean pretest)
Note: The pretestConnections property is not fully effective until IBM i 7.1.
pretest - If connections are pretested before being allocated.AS400.isConnectionAlive()public void setRunMaintenance(boolean cleanup)
setThreadUsed can be set
in interchangeable order.
The default value is true.cleanup - If expired connections are cleaned up by the maintenance daemon.public void setThreadUsed(boolean useThreads)
setRunMaintenance can be called
in interchangeable order.
The default value is true.useThreads - true to use additional threads; false otherwise.