EOObjectStoreCoordinator parentObjectStore = new EOObjectStoreCoordinator();
EOEditingContext editingContext = new EOEditingContext(parentObjectStore);
This looks like it's working in that it opens two new connection to the database when I start a new session. As expected.
When I'm terminate the session I use this code to close the connection to the database:
EOObjectStoreCoordinator parentObjectStore = (EOObjectStoreCoordinator)(editingContext.parentObjectStore());
NSArray databaseContexts = parentObjectStore.cooperatingObjectStores();
int contextCount = databaseContexts.count();
for (int i = 0; i < contextCount; i++) {
NSArray channels = ((EODatabaseContext)databaseContexts.objectAtIndex(i)).registeredChannels();
int channelCount = channels.count();
for (int j = 0; j < channelCount; j++) {
//Make sure the channel you're trying to close isn't performing a transaction.
if (!((EODatabaseChannel)channels.objectAtIndex(j)).adaptorChannel().adaptorContext().hasOpenTransaction()) {
((EODatabaseChannel)channels.objectAtIndex(j)).adaptorChannel().closeChannel();
}
}
}
This closes one of the two database connection, not both.
Is there a way to detect the one extra connection or not open the extra connection in the first place?
WOnder may have resolved this issue but adding WOnder is a bigger undertaking then I originally expected.
Paraphrasing Lou Reed, I just want some of it, not all of it.