|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
This interface is used to wrap the SmartPool to an existing connection pool.
To wrap the SmartPool to an existing pool, provide an instance of this interface in the configuration file. SmartPool will then draw connection from this pool rather then drawing raw connections to the pool.
Also if the SmartPool is wrapped around another pool it will draw a connection on every call by calling ConnectionProvider.getConnection().
Similarly when you call Connection.close(), SmartPool returns the connection back to the original pool immediately by calling ConnectionProvider.returnConnection().
In short when this feature is used, SmartPool is just another layer of indirection. SmartPool does not maintain any pool. This has been specifically designed to do so. This is because the external pool to which SmartPool is wrapped is expected to do all the pooling. SmartPool can be used to detect leaks and monitor live connections etc.
| Method Summary | |
java.sql.Connection |
getConnection()
This method implementation should fetch the connection. |
void |
returnConnection(java.sql.Connection conn)
This method implementation should release the connection. Whatever postprocessing you want to do, do it here. e.g. |
| Method Detail |
public java.sql.Connection getConnection()
throws java.lang.Exception
This method implementation should fetch the connection. This method is expected to block if a connection is not available untill a connection a available.
Whatever preprocessing you want to do, do it here. SmartPool will not manuplate the connection state in anyway.
e.g. of preprocessing:If you throw any Exception while doing this, SmartPool will wrap this exception with ConnectionPoolException and throw it back to you in the SmartPoolFactory.getConnection() method. So better behave your self and handle all the cases here itself.
public void returnConnection(java.sql.Connection conn)
throws java.lang.Exception
This method implementation should release the connection.
Whatever postprocessing you want to do, do it here.
e.g. of postprocessingIf you throw any Exception while doing this, SmartPool will wrap this exception with SQLException and throw it back to you in the Connection.close() method. So better behave your self and handle all the cases here itself.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||