|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.emp.cci.eci.ECIConnectionManager
A connection manager for ECI connections.
This is the default connection manager for use in unmanaged applications that use the ECI. This class is never used for managed applications.
This connection manager provides support for connection pooling. The use of connection pooling allows the programmer to optimize performance in the sequential usage of connections, as well as allowing the limiting of concurrent resource usage amongst servers.
The connection manager is configured through 2 properties:
maximumPoolSize
- This governs the maximum number
of connections in the pool. If an attempt is made to get a connection
when this number of connections are already allocated, then the request
blocks until the timeout fires, or until a connection becomes available.
poolTimeout
- This governs the amount of time to
wait for a connection to become available.
Connection pooling can be turned off by setting the maximum pool size to zero.
The configuration of the manager can only be performed before any
request for a connection is issued. An attempt to configure it after this
time will result in a javax.resource.spi.IllegalStateException
being generated.
Debuging of the connection manager is facilitated by the use of the
logWriter
property.
Constructor Summary | |
ECIConnectionManager()
Constructor. |
Method Summary | |
Object |
allocateConnection(ManagedConnectionFactory mcf,
ConnectionRequestInfo cri)
|
PrintWriter |
getLogWriter()
Get the debug destination for this object. |
int |
getMaxPoolSize()
Get the maximum size of the connection pool. |
int |
getPoolTimeout()
Get the timeout value for connection allocation. |
void |
setLogWriter(PrintWriter pw)
Set the debug destination for this object. |
void |
setMaxPoolSize(int newMaxPoolSize)
Set the maximum size of the connection pool. |
void |
setPoolTimeout(int newPoolTimeout)
Set the timeout value for connection allocation. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ECIConnectionManager()
Create a connection manager that provides connection pooling with a pool size of 20 and a timeout of 5 seconds.
Method Detail |
public Object allocateConnection(ManagedConnectionFactory mcf, ConnectionRequestInfo cri) throws ResourceException
allocateConnection
in interface ConnectionManager
ResourceException
public int getMaxPoolSize()
A return value of zero indicates that pooling is not enabled.
public void setMaxPoolSize(int newMaxPoolSize) throws IllegalStateException
A value of zero turns off connection pooling.
newMaxPoolSize
- The new maximum pool size.
IllegalArgumentException
- if the new pool size is
not >= 0.
IllegalStateException
- if this manager is not
allowed further configuration. This situation occurs when the first
request for a connection occurs.public int getPoolTimeout()
public void setPoolTimeout(int newPoolTimeout) throws IllegalStateException
newPoolTimeout
- The pool timeout in milliseconds. A value of 0
means there is no timeout.
IllegalArgumentException
- if the supplied timeout is
negative.
IllegalStateException
- if this manager is not
allowed further configuration. This situation occurs when the first
request for a connection occurs.public void setLogWriter(PrintWriter pw)
The writer may be null, providing no debug output.
pw
- The new debug destination.public PrintWriter getLogWriter()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |