For reference, here is my terminate method:
public void terminate()
{
// Need to make sure this is unlocked so that editing contexts nested in the defaultEditingContext
// don't hold locks on it when it gets disposed
synchronized (ecLockManager)
{
if (ecLockManager().isLocked())
{
try
{
ecLockManager().unlock();
}
catch (Throwable t)
{
// DANGEROUS: we *must* eat this exception or the whole app might deadlock
NSLog.err.appendln("********** EXCEPTION in WOSession.terminate() calling ecLockManager.unlock(): " + t);
}
}
}
super.terminate();
NSLog.out.appendln("Terminated session " + sessionID());
NSLog.out.appendln("Remaining active sessions: " + WOApplication.application().activeSessionsCount());
}