Thanks Aaron,

In mysql I use:
show status like "Threads_connected";

to see the two connections added when I create an OSC in the session, key 
elements being:

objectStoreCoordinator = new ERXObjectStoreCoordinator(true); // true = close 
db connections on closing
this.ec = ERXEC.newEditingContext(objectStoreCoordinator);
setDefaultEditingContext(this.ec);

Then to tidy up in terminate I use:

objectStoreCoordinator.dispose();

which invokes ERXEOAccessUtilities.closeDatabaseConnections() on itself

Whether or not I dispose of the ec as well, or call 
ERXEOAccessUtilities.closeDatabaseConnections() on the osc myself, I still get 
only one of the database connections dropped.

John

On 16 Mar 2014, at 09:35, Aaron Rosenzweig <aa...@chatnbike.com> wrote:

> I’m sorry John,
> 
> I’m traveling in a faraway land and have had spotty Internet until now.
> 
> Short answer - I don’t know, if you did it right both (2) DB connections 
> should be gone now. 
> 
> Long answer below:
> 
> Doing “dispose” of the ObjectStoreCoordinator (not the EC) should release the 
> primary DB connection that your WOApp was using.
> 
> To dispose of the 2nd “hidden” connection that was only used to get the JDBC 
> info and then not used… you must use the Wonder utilities call. 
> 
> My guess is that if you are using the Wonder utilities and see one of your 
> two connections dropping then your problem is that you are disposing the EC 
> by accident instead of the EC’s ObjectStoreCoordinator. It has to be the 
> “Coordinator” that you are disposing because that is what holds the 
> connection to the DB, not the EC. 
> 
> Double check :-)
> 
> Cheers,
> AARON ROSENZWEIG / Chat 'n Bike
> e:  aa...@chatnbike.com  t:  (301) 956-2319           
>       
> 
> On Mar 14, 2014, at 10:16 PM, John Pollard <j...@pollardweb.com> wrote:
> 
>> I see that constructing ERXObjectStoreCoordinator(true) is another way to 
>> work around the issue of closing the db connection.
>> However, I still get two connections created and only one closed when 
>> disposed.
>> John
>> 
>> On 13 Mar 2014, at 14:33, John Pollard <j...@pollardweb.com> wrote:
>> 
>>> Thanks Aaron, half way there, that closed one of the two connections, but 
>>> neither of mine were closing so still one left open after the following 
>>> code?
>>> John
>>> 
>>> On 13 Mar 2014, at 13:04, Aaron Rosenzweig <aa...@chatnbike.com> wrote:
>>> 
>>>> Hi John,
>>>> 
>>>> Yes, that’s a known Apple bug. It creates an extra one to read “Database 
>>>> info” and then never releases it. There is a Wonder method to close 
>>>> database connections like that.
>>>> 
>>>> ec.dispose();
>>>> ERXEOAccessUtilities.closeDatabaseConnections(objectStore);
>>>> objectStore.dispose();
>>>> 
>>>> Cheers,
>>>> AARON ROSENZWEIG / Chat 'n Bike
>>>> e:  aa...@chatnbike.com  t:  (301) 956-2319                
>>>>    
>>>> 
>>>> On Mar 13, 2014, at 8:40 AM, John Pollard <j...@pollardweb.com> wrote:
>>>> 
>>>>> Hi List,
>>>>> 
>>>>> I have noticed that the database connections (seen using "show 
>>>>> processlist" within mysql) are not being released.
>>>>> I create my own ERXObjectStoreCoordinator and this results in two new 
>>>>> mysql connections appearing.
>>>>> When later I call dispose() on that ERXObjectStoreCoordinator, the 
>>>>> database connections are not being freed up.
>>>>> The dispose() call is in a Session.terminate() method, called after 
>>>>> super.terminate().
>>>>> 
>>>>> Thanks for any thoughts on this.
>>>>> 
>>>>> John
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>>>>> 
>>>>> This email sent to aa...@chatnbike.com
>>>> 
>>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>> 
>> This email sent to aa...@chatnbike.com
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to