"There are several circumstances where two different pieces of code can be
inadvertently sharing the same connection."
Connection pool user is responsable for this. User can store connection in
ThreadLocal or
implement something like this:
class MySafeConnection implements InvokationHandler{
Connection connection;
WeakReference owner;
MySafeConnection(Connection connection){
this.connection = connection;
owner = new WeakReference( Thread.currentThread() );
}
Object invoke(Object obj, Method method, Object args[] ) throw Throwable{
if( owner.get() == Thread.currentThread() ){
method.invoke( connection, args );
}else{
throw new IllegalStateExeption();
}
}
static Connection decorate(Connection connection){
return
(Connection)Proxy.newProxyInstance(connection.getClass().getClassLoader(),
new Class[] {Connection.class}, new
MySafeConnection(connection));
}
}
It is trivial, isn't it ?
I do not think stuff like this must be included in to pool distribution, but
it can be in documentation.
----- Original Message -----
From: "Mario Ivankovits" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 6:34 PM
Subject: [DBCP] Please let us start to improve the connection pool
Hello !
There are some bug or RFE in DBCP which sould be fixed.
Some people (including me) have already posted in this list, but it seems
there is no DBCP developer anymore or he/she is very busy.
Could one of the DBCP people please comment on how and when development in
DBCP could advance.
I would like to help in improving it (i have already posted a patch for
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17677), but if there is no
one in this list who is willing to discuss, it is hard to do it right.
Hope to hear from one of you ...
Ciao,
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]