Subject Re: [IB-Java] Re: Problem with FBManagedConnection
Author David Jencks
On 2002.02.16 15:39:42 -0500 patcom123 wrote:
> > This seems to be a bug unless i'm misunderstanding how things work?
> > It would seem sensible to remove a connection listener whenever a
> > connection is closed/error occurred in the while loop in notify?
> > But i'm not sure if this would affect other things or there is a
> > better place to stick it?
>
> Ahh, didn't mean notify there. Anyway i've changed the
> connectionEvent class within the allocateConnection function of the
> FBPoolingConnectionManager class to the following
>
> public void connectionClosed(ConnectionEvent event){
> //there can only be one Connection handle for this managed
> connection.
> returnManagedConnection(localmc, false);
> localmc.removeConnectionEventListener(this);
> }
>
> and the same for connectionErrorOccurred.

This is almost exactly correct. The only difference needed is to remove the
ConnectionEventListener _before_ putting the managed connection back in the
pool. Otherwise you can get very strange results whereby someone else
starts using the connection before the old listener is removed -- I think
exactly the situation you found originally.

Thanks again for finding this.

david jencks
>
> What do people think. I tested it on my system and it seems to work
> ok, but like i say, i don't fully understand the connection
> management stuff and what happens when a connection is released....
>
>
> JOHN
>
>
>
> To unsubscribe from this group, send an email to:
> IB-Java-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>