internal void PostPop(object newOwner)
{
GlobalLog.Assert(!IsEmancipated, "Pooled object not in pool.");
GlobalLog.Assert(CanBePooled, "Pooled object is not poolable.");
lock (this) {
if (null == m_Owner)
{
m_Owner = new WeakReference(newOwner);
}
else
{
if (null != m_Owner.Target)
{
throw new InternalException(); // pooled connection already has an owner!
}
m_Owner.Target = newOwner;
}
m_PooledCount--;
if (null != Pool)
{
if (0 != m_PooledCount)
{
throw new InternalException(); // popping object off stack with multiple pooledCount
}
}
else
{
if (-1 != m_PooledCount)
{
throw new InternalException(); // popping object off stack with multiple pooledCount
}
}
}
}